Wowchemy-hugo-modules: Translation menu is broken when BaseURL is different for other langs

Created on 30 Dec 2019  路  6Comments  路  Source: wowchemy/wowchemy-hugo-modules

Describe the bug

After updating to latest commit, the dropdown translation menu appears to be broken, clicking on another language just refreshes the page but does not change the language.

I'm using different baseURLs for the different translations. It used to work well on version 4.6 of Academic. Maybe I missed something on the release notes, but I was not able to find a solution or a breaking change.

This issue is present both in production and in localhost.

To Reproduce

Steps to reproduce the behavior:

  1. Click on the language drop down menu.
  2. Click on any language.
  3. The page refreshes without changing the language.

Expected behavior

Changing the website language, and in my case, changing the url.

Technical details:

  • Academic Version: commit 19901344555a31356126f85611d74cee7bb49280
  • Hugo Version: v0.62.0/extended darwin/amd64
  • Browser/OS: Safari, Firefox, Chrome in MacOS/iOS
good first issue help wanted needs investigation upstream

Most helpful comment

I tried your fix and it works! Thank you so much for the fast help!

All 6 comments

To upgrade from v4.6.0 to v4.7.0-dev, you would have had to update Hugo to v0.60+, a major new version with breaking changes.

Academic's code for translating has not changed between v4.6 and v4.7 and there appears to be no issue with translations generally (without changing baseUrl for each translation), such as on Academic's docs site (which currently uses Academic v4.7-dev with English and Chinese translations).

Therefore, I suspect that any issue with content translation may be related to using a different baseURL for each translation in conjunction with updating your version of Hugo to a major new version with breaking changes (possibly including in the area of content translation with diff. baseUrls). Someone may wish to consider looking into the following:

  1. confirm the issue only arises when using different baseURLs (i.e. test using the same baseURL)
  2. investigate the Hugo changelogs in this area from Hugo v0.60.0 and also v0.61.0 and v0.62.0 (as that's the version @pjox reported using)

I can immediately confirm the issue only arises when using different baseURLs.

I also remember previous versions of Hugo gave me a .RelPermalink related warning when I used translations (and only when using different baseUrls), but this warning has disappeared since upgrading to Hugo v0.60.0+ and using Academic v4.7.0-dev.

I'll try to downgrade the versions of Hugo and Academic to reproduce the warning as I sadly never payed much attention to it and don't remember the exact content of it.

I have the exact same problem as @pjox, also working with two different baseURLs. I upgraded to Hugo v.0.62.1 and Academic v4.6. I also checked and corrected any breaking changes occurring with the upgrade since my previous version, but it didn't help!

OK, thanks for the info on .RelPermalink related warning. Can you try the latest master version - I've changed the translation URL to .Permalink, hopefully might fix the issue which you experienced?

I tried your fix and it works! Thank you so much for the fast help!

I can also confirm the problem is gone in the last commit. Thank you for the help! 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pjox picture pjox  路  4Comments

petzi53 picture petzi53  路  4Comments

somnathrakshit picture somnathrakshit  路  3Comments

halfrost picture halfrost  路  3Comments

chris-prener picture chris-prener  路  3Comments