Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

@self.items: Show only items of current language

Started by Muut Archive 10 years ago · 1 replies · 554 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 Muut Archive, 10 years ago
1 674 1 week ago
Archive · by Deleted User, 9 years ago
0 3043 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5337 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago