Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

How to use translated taxonomy in page collections

Started by Pedro M 4 years ago · 0 replies · 379 views
4 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 Jerry Hunt, 4 days ago
2 101 16 hours ago
General · by pamtbaau, 22 hours ago
1 68 21 hours ago
General · by Andy Miller, 1 day ago
0 53 1 day ago
General · by Marcel, 12 months ago
6 361 5 days ago
General · by Duc , 6 days ago
3 49 6 days ago