Partial based on path? (navbar based on language)

Is there a way to have a partial based on something in the path?

I have hard coded navbar > {{ partial "navbar.html" . }} on all pages - except on /de/ where I want to use {{ partial "navbar.de.html" . }}

How can I achieve that?

{{ partial (printf "navbar.%s.html" .Lang) . }}
2 Likes

That took me a while to work out. Now it’s working, what did the trick:

the *.md in question all are…
in /de/
language: de
url: /de/example-daten/

Something in the above did the trick. Thank you for the hint!

You do not have to place either of those values in front matter if your site is properly configured.

I did some cross testing. Seems only the de in i.e. test.de.md matters, the rest does not. File location can be root too. Interesting.