Imprint link in an multilingual setup

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.

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 Like