themefisher / meghna-hugo

Meghna Hugo is a responsive, minimalist, lightweight, and fast loading one-page business theme built with HTML5/CSS3, Hugo, JavaScript, and JQuery.
https://gethugothemes.com/products/meghna/?utm_source=meghna_github&utm_medium=referral&utm_campaign=github_theme_about
MIT License
441 stars 1.23k forks source link

Multilingual menu not working #145

Closed lupa18 closed 3 years ago

lupa18 commented 3 years ago

Hello ! after installing and testing, I see that menu doesn't change when I switch from English to French.

I miss something?

thanks in advance

tfsomrat commented 3 years ago

Hello @lupa18

Thanks for your concern, we added multilingual navigation, please download the latest code and enjoy...

lupa18 commented 3 years ago

hi @developer-evan ! thanks for your answer.

I think you missed the anchor language prefix for non-default language. For example each French menu entry, should have something like: pre = "fr/#"

I hope help with this comment.

SoerenGreule commented 3 years ago

I think you missed the anchor language prefix for non-default language.

I am getting this impression, too. The navigations always links to the default language. This is the case on the demo site, too. As a workaround you can fix it by setting defaultContentLanguageInSubdir: true in the config.yaml and then (in the same file) add the language short in front of the pre for each section in the menu. E.g.

menu:
   main:
        - name: about
          pre: 'en/#'
          url: about
          weight: 1
        - name: services
          pre: 'en/#'
          url: services
          weight: 2

Edit: You can also just add the language short in front of the pre in the language which is not set as default language and skip setting defaultContentLanguageInSubdir: true.