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 →

Get translation of page.title for present page

Started by Joachim Liedtke 9 years ago · 3 replies · 1041 views
9 years ago

Scenario:
On my English version of a page I would like to insert the German translation of the 'page.title' (or any other header information) dynamicaly via Twig variable.

How can I access the 'page.de.md' header information while being on the English version?

9 years ago

Found a solution myself:

To access a certian translation you would do something like this: {{ page.title|tl(['de']) }}

Hope that helps anybody.

last edited 04/16/18 by Joachim Liedtke
9 years ago

The above mentioned solution is not working. Still looking for something working ... :o/

9 years ago

Perhaps if you add the language of every page in it's header or frontmatter and create a collection, you could use some Twig logic to filter and get the desired page title?

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 1 year ago
6 1564 1 year ago
Content & Markdown · by Ton Haarmans, 2 years ago
10 1187 2 years ago
Content & Markdown · by Jan L'Am, 2 years ago
4 1055 2 years ago
Content & Markdown · by Leonardo, 2 years ago
3 964 2 years ago
Content & Markdown · by belthasar, 2 years ago
4 1439 2 years ago