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

@self.items: Show only items of current language

Started by Muut Archive 10 years ago · 1 replies · 402 views
10 years ago

-I have a job listings page in /jobs. The job pages are e.g. /jobs/job1
-The default language is german
-Some jobs have been translated to english

I want, that when the active language is english, only the jobs translated to english are listed in the job listings page.

I have already tried deactivating the language fallback but the german jobs are still listed.

Is there maybe a way to check the language of a page?

btw. you guys are doing an awesome job, I am so glad that I always get help here in this forum!

10 years ago

you can filter out certain pages based on their language:

TWIG
{% for page in collection if page.language == 'de' %}
...output stuff...
{% endfor %}

This will ensure the output only displays the page only if it's German.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2956 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago