Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

How to use translated taxonomy in page collections

Started by Pedro M 5 years ago · 0 replies · 543 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 jeremycherfas, 1 week ago
5 196 4 hours ago
General · by lynbor, 6 days ago
2 129 3 days ago
General · by Old Man Umby, 1 week ago
1 103 1 week ago
General · by Sebastian, 2 weeks ago
1 128 2 weeks ago
General · by Andy Miller, 3 weeks ago
0 251 3 weeks ago