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 →

Imprint link in an multilingual setup

Started by Nico Petri 9 years ago · 1 replies · 974 views
9 years ago

Hello there,

i have a multilingual setup and want to include an imprint link to the footer. So i put this on my footer.html.twig file:

<a href="{{ page.find('/imprint').slug }} ">{{ page.find('/imprint').title }}</a>

But if i ever translate this page the page.find('/imprint') will probably fail. So how did u deal with that? Mayby override the slug in the frontmatter in every single translated file?

Thx in advance.

9 years ago

Grav will find the current translation version of the page, and put the correct URL in that Twig code.

You can also write an if in the Twig, and check for the current active language, and output a different URL.

👍 1

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by MarkP, 2 weeks ago
3 193 2 weeks ago
Themes & Styling · by TomW, 2 weeks ago
0 111 2 weeks ago
Themes & Styling · by themetman, 3 weeks ago
1 206 3 weeks ago
Themes & Styling · by AH, 1 month ago
1 324 3 weeks ago
Themes & Styling · by Bruno, 4 years ago
6 1523 3 weeks ago