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

How to use translated taxonomy in page collections

Started by Pedro M 4 years ago · 0 replies · 508 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 jean-louis67, 3 weeks ago
2 311 3 weeks ago
General · by Andy Miller, 3 weeks ago
0 312 3 weeks ago
General · by Veehem, 4 weeks ago
0 264 4 weeks ago
General · by milkboy, 4 weeks ago
0 267 4 weeks ago
General · by ian russell, 1 month ago
2 336 1 month ago