Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

How to use translated taxonomy in page collections

Started by Pedro M 5 years ago · 0 replies · 598 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 Andy Miller, 1 week ago
0 140 1 week ago
General · by lynbor, 1 month ago
3 456 2 weeks ago
General · by lynbor, 3 weeks ago
7 591 2 weeks ago
General · by Harry, 2 weeks ago
0 178 2 weeks ago
General · by Old Man Umby, 1 month ago
2 319 4 weeks ago