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.

Themes & Styling

Imprint link in an multilingual setup

Started by Nico Petri 9 years ago · 1 replies · 623 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 Pedro M, 2 months ago
4 193 2 months ago
Themes & Styling · by Ian, 2 months ago
3 91 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 451 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 45 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 125 3 months ago