Hi all.
First of all, my website is deployed here, and uses the hugo-profile theme.
You can look at the code in the GitHub Pages repository here.
The site uses a multilingual setup, where the default language is deployed at the root (/
), and the secondary one lives in a subfolder.
Up until recently, everything was working fine. I could use the language switcher to freely change between English and Spanish, and the appropriate content would be loaded. I also have a custom shortcode that was working wonderfully, which loads the original language of a page if there isn’t a localized version for the currently selected language.
Here’s a link to an older commit where everything was working as expected. Please note, at this point in time English was the default language (root folder), whereas Spanish was in the /es subfolder.
However, I recently made some significant changes that modified a few things:
- Spanish is now the default language, whereas English lives in the
/en
subfolder. - The layout was modified so that the blog now shows up as the home page, following the advice I received in this thread:
Generate the main home page in a subfolder instead of the base URL? - #6 by VMX - Added a few more things such as RSS feeds for the blog.
When I run hugo server
in my local machine, everything works perfectly at http://localhost:1313
. Spanish is loaded at the root, and I can freely switch between English and Spanish using the dropdown. My shortcode also works perfectly.
However, when I push that to the master branch and the site gets deploye by GitHub Actions, the multilanguage setup breaks. The default language (Spanish) still works just fine, but when I switch to English the homepage doesn’t show the blog posts but rather the About
page (in Spanish too!), my translation shortcode no longer works in blog posts, and the nav bar links are also generally broken.
I’ve made sure to purge the /public
folder before building, reload the site avoiding caches, etc., and also tried playing around with a few more settings. But for the life of me I can’t figure out what’s causing the site to break when deployed online while it continues to work wonderfully in my machine.
Any help would be greatly appreciated!