MunifTanjim / minimo

Minimo - Minimalist theme for Hugo
https://minimo.netlify.app
MIT License
545 stars 220 forks source link

Multilanguage support #254

Open environmentalistvip opened 4 years ago

environmentalistvip commented 4 years ago

Hello,

I wanted to be able to view links to switch the language of the web site. However it seems that the partials to display the secondary languages are missing: https://gohugo.io/content-management/multilingual/#reference-the-translated-content

I wish I could do a pull request, but it beyond my coding ability. It would be amazing to have the theme support multilanguage blogs.

Guillawme commented 4 years ago

I started tinkering with this, I will let you know when I have it online on my website. If it looks fine, I could clean it up and submit a pull request here, but I have no idea whether my solution integrates well with Minimo.

I figured that this would work as a new translations widget. If the current page has translations, and if the widget is activated, then a list of links to the equivalent page in other languages is displayed. It makes the most sense to have this widget in the sidebar (it looks really ugly in the header, and not visible enough in the footer for pages taller than one screen). I have a working solution, but I am not sure how to integrate it well with the CSS and the configuration system of Minimo.

Guillawme commented 4 years ago

You can see it in action on my website. All pages listed in the top menu (Blog, About, Contact, etc.) are translated, so when you navigate to them you should see in the sidebar a link FR: <page title in French> (conversely, if you're on the French version of these pages, the link will be EN: <page title in English>). I don't translate my blog posts (because I post completely different things in French and English), so if you navigate to any blog post you won't see the translation link.

Here is the commit showing how I made this widget. I copied the social_menu widget and replaced its content with this piece of code from the Hugo documentation.

troyane commented 4 years ago

@MunifTanjim how is it going? Do you plan to add this feature to newer theme version?