Multilingual Support for Partials?

Hello,

I am facing an issue when trying to use my multilingual site with different partials. Let me explain:

my config.toml:

DefaultContentLanguage = "en"
[languages]
  [languages.en]
    title = "My Site"
    languageName = "English"
    contentDir = "content/english"
    weight = 1
  [languages.fr]
    title = "My French Title"
    languageName = "French"
    contentDir = "content/french"
    weight = 2

My http://localhost:1313 and http://localhost:1313/fr work pretty fine: No issues

Issue is with my baseof.html file

<!DOCTYPE html>
<html lang="{{ with .Site.Languages }}{{ . }}{{ else }}en-US{{ end }}">
    {{- partial "head.html" . -}}
    <body>
        {{- partial "header.html" . -}}
        {{- block "main" . }}{{- end }}
        {{- partial "footer.html" . -}}
    </body>
</html>

Both index.html and index.fr.html are working fine and I am able to separately customize both. However, my footer is still stuck with the original en one even when I switch to fr.

I understand that this is due to that fact that the footer is a partial, but trying footer.fr.html in the same folder as footer.html is not solving as well.

Please help me with the code to change it so that I can utilize en footer for English and fr footer for French

Thanks,
Ayan

I created another baseof.fr.html and changed the reference to footer partial. Works now :slight_smile:

1 Like

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