Wowchemy-hugo-modules: Add multilingual support

Created on 19 Dec 2016  路  7Comments  路  Source: wowchemy/wowchemy-hugo-modules

Todo:

  • [x] add language chooser in the navigation bar - implemented in #151
  • [x] add multilingual support to homepage widget system
  • [x] replace some relURL/absURL calls with relLangURL/absLangURL as necessary
  • [x] add <link rel="alternate"> tags to header for other language versions of a page - actually implemented equivalent links in sitemap instead (see #150)
  • [x] test with multlingual versions of content

Based on discussion from #12 and https://gohugo.io/content/multilingual/ .

enhancement help wanted

All 7 comments

I know, there is no official multilingual support yet, but I found some issue with navigation. If I rename widget.md to widget.<lang>.md in content directory (for example. about.md to about.en.md) navigation doesn't work, because <section> id changes. If I change links in config.toml (for example, url = "#about.en", smooth scroll doesn't work. :)

@UltraCoderRU thanks for the description of the multilingual homepage issue. The smooth scroll in this case is probably easy to fix with Javascript, but ideally we want a website with URLs like /#about for default language and /ru/#about for Russian version, for example. I'll add it to the to-do list above and try to fix it sometime.

@UltraCoderRU Multilingual support just improved a lot with update b99e5a1e2187d69096107865b063fffe8421b5de 馃槂

Multilingual support added for:

  • homepage widget system (fixes your navigation/widget problem)
  • navigation bar links (fixes your navigation/widget problem)
  • 'more posts/publications/talks' links in widgets

Please let me know your feedback when you have a chance to test it.

@gcushen Thanks, now navigation works correctly. But I found another issue: variables redefinition in [languages.X.params] in config.toml doesn't work.

@UltraCoderRU I just tried putting the [params] variables under [languages.X] and it works. It seems that Hugo allows you to put both the core Hugo variables like title = "My blog" and the Academic [params] variables (like name = "My name in Russian") under the [languages.X] configuration section. I think that the Hugo team could perhaps have chosen a more logical way to declare the multilingual parameters, but it works!

The following works:

[Languages.ru]
# General Hugo configuration
copyright = "My copyright in Russian"
title = "My Russian blog"

# Academic's `[params]` configuration
name = "My Russian name"
role = "Professor of Russian"
organization = "My University's name in Russian"

@gcushen Yes, it works that way. Seems like Hugo team created a possibility of name collisions. :)

@UltraCoderRU Yes, I assume it's a bug in Hugo, but I haven't searched their Github issues for it. I hope you don't find any name collisions 馃槅

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Framartin picture Framartin  路  4Comments

eduardohenriquearnold picture eduardohenriquearnold  路  4Comments

brianguay picture brianguay  路  4Comments

gcushen picture gcushen  路  4Comments

pjox picture pjox  路  4Comments