URL change when change languages in web

I deploy a hugo into github-page. Web like this nguyenchungvan.github.io/test-deploy.

But when I transfer to another languages, the url change like this nguyenchungvan.github.io/vi/
instead of .../test-deploy/vi/, and this cause 404

There isn’t a GitHub Pages site here.

This is my configure page:

relativeURLs = true
# Change the default theme to be use when building the site with Hugo
theme = "hugo-theme-learn"
# For search functionality
[outputs]
home = [ "HTML", "RSS", "JSON"]

I use relativeURLs = true for access to static images. The changing languages worked normally when running in local host. Please give me some advice for this.

My guess is that the languages/contentdir section is not configured properly in your config:

my config file like the document: relativeURLs = true

# Change the default theme to be use when building the site with Hugo
theme = "hugo-theme-learn"

# For search functionality
[outputs]
home = [ "HTML", "RSS", "JSON"]

[params]
  # Change default color scheme with a variant one. Can be "red", "blue", "green".
  themeVariant = "workshop"
  # Git hub repo link
  editURL = ""
  description = ""
  author = "journeyoftheaverageguy@gmail.com"
  showVisitedLinks = true
  disableBreadcrumb = false
  disableNextPrev = false
  
[Languages]
[Languages.en]
title = "AWS System Manager"
weight = 1
languageName = "English"

[[Languages.en.menu.shortcuts]]
name = "<i class='fab fa-facebook'></i> AWS Study Group"
identifier = "AWS Study Group FB"
url = "groups/awsstudygroupfcj/"
weight = 20

[Languages.vi]
title = "AWS System Manager"
weight = 2
languageName = "Tiếng Việt"

[[Languages.vi.menu.shortcuts]]
name = "<i class='fab fa-facebook'></i> AWS Study Group"
identifier = "AWS Study Group FB"
url = "groups/awsstudygroupfcj/"
weight = 20

It sounds like your baseURL isn’t set correctly.

But without a link to your repo, this is just guessing. Let us see your code.

my repo:
https://github.com/nguyenchungvan/ncv2301.github.io

I try to add a URL for my home page in to themes/hugo-themes-learn/layout/partials/menu.html and it works!

Your repo contains the build result of Hugo. This is not helpful.

The sources are necessary (config.toml, hugo.toml, content dir, etc).

For the moment I stay with this:

It sounds like your baseURL isn’t set correctly.

Please check the above link and assert you have the right settings in your config.toml / hugo.toml.

2 Likes

My repo for project: GitHub - chungvan2301/suppor

Your baseURL isn’t set at all.

PLEASE read the above link and feel free to ask if anything is still unclear.

Three more points:

  • You are missing the defaultContentLanguage setting in your toplevel config section

  • There’s no need to use relativeUrls to get static images in fact the doc tell it like this:

    From the docs

    Do not enable this option unless you are creating a serverless site, navigable via the file system.

  • the learn theme you are using is out of maintenance -

    from the themes repo

    THIS PROJECT IS DEPRECATED

    The project is not maintained anymore. …

Check the links I posted for more information

1 Like

thank you for your support :+1: :+1: