Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

How to use translated taxonomy in page collections

Started by Pedro M 5 years ago · 0 replies · 692 views
5 years ago

Hi.

I'm trying to get the pages in collection through their taxonomy filter. I have this code in a twig template:

TWIG
{% for page in page.evaluate({'@taxonomy.category':'featured'}).order('date', 'desc') %}

I'd like to change 'featured' to a translated string, like this:

TWIG
{{'THEME_NAME.TAXONOMY_TAGS.FEATURED'|t}}

( THEME_NAME.TAXONOMY_TAGS.FEATURED is a variable configured in languages.yaml translated into two languages. )

I get the following error:

A hash value must be followed by a comma. Unexpected token "name" of value "TAXONOMY_TAGS_FEATURED" ("punctuation" expected with value ",").

Is there anyway to use translated variables in taxonomy filters?

Thanks in advanced.

Suggested topics

Topic Participants Replies Views Activity
General · by themetman, 24 hours ago
2 41 17 hours ago
General · by Hanns Mattes, 1 week ago
0 121 1 week ago
General · by Karmalakas, 1 week ago
2 185 1 week ago
General · by Hanns Mattes, 3 weeks ago
0 235 3 weeks ago
General · by Dima, 4 weeks ago
1 211 4 weeks ago