Is it possible to identify a page or section across multiple languages with native/existing parameters?

Background: I sometimes load extra (S)CSS styles targeting specific pages/sections and have done so for a single-language site making a variable like this {{ $pageName := .LinkTitle | urlize }} and fetch a similarly named stylesheet under assets/scss/pages/. This does not work with multiple languages however, as the .LinkTitle changes depending on the current language.

Current solution: Creating a custom parameter that I add to the front matter of that page/section for every language. Have a look at the specific code in its context.

What I’m after: A “native” way to identify a post/section across multiple languages. My goal is to avoid using a custom param in front matter. It does not even have to be a name, it can be a random string – as long as it does not change and is shared across languages.

Any suggestions?

{{ .TranslationKey }}
2 Likes

Thanks, clean and simple :+1:

…and a reminder to myself to read the docs a couple of more times before giving up, hehe.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.