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.

Content & Markdown

Get translation of page.title for present page

Started by Joachim Liedtke 8 years ago · 3 replies · 699 views
8 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?

8 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
8 years ago

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

8 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, 8 months ago
6 99 8 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 186 1 year ago
Content & Markdown · by Jan L'Am, 1 year ago
4 148 1 year ago
Content & Markdown · by Leonardo, 1 year ago
3 62 1 year ago
Content & Markdown · by belthasar, 1 year ago
4 257 1 year ago