.BaseFileName of a translated page

Hi!

How can I get a page save on content/account/login.en.md without have to hardcode the language suffix?

{{ range where .Site.Pages ".File.BaseFileName" "login" }}
[...]
{{ end }}

Thanks!

Apparently, we need to document the translation-related .File fields:

Given /content/post/example.en.md
{{ .File.TranslationBaseName }} yields "example"
{{ .File.BaseFileName }} yields "example.en"
{{ .File.Lang }} should match {{ .Lang }} and yield "en"

Edit: fixed typo in file name

I believe you mean example.en.md, right?

Thank you so much, @moorereason!

No, I think I meant what I said. .File.LogicalName is example.en.md. Try it and let me know if Iā€™m wrong.

I understood, but you wrote example.en.html, instead of example.en.md.

1 Like
2 Likes