Multilanguage

I am trying to use the Multilanguage feature but I am not able to generate the files. I am getting a blank page on localhost:1313/fr.

So this is my setup

languageCode = 'en-us'
title = 'My New Hugo Site'
defaultContentLanguage = 'en'

##Languages code
[Languages]
  [languages.en]
      baseURL = 'http://localhost:1313/'
      languageName = 'English'
      title = 'In English'
      weight  = 1
  [languages.fr]
      baseURL = 'http://localhost:1313/fr'
      languageName = 'Français'
      title = 'French'
      weight  = 2

On the markdown. I made two files in content

  • _index.md for the english homepage
  • _index.fr.md - I was thinking this is suppose to show up for localhost:1313/fr or locahost:1313.fr. But I don’t see this _index.fr.md page.

Please help. I have followed the documentation but I am not sure where I am getting things wrong.

Define baseURL at the root of your configuration file, and remove the baseURL values from the language tables.

diff --git a/config.toml b/config.toml
index c14492852..b3fe11086 100644
--- a/config.toml
+++ b/config.toml
@@ -1,14 +1,13 @@
+baseURL = 'https://example.org/'
 languageCode = 'en-us'
 title = 'My New Hugo Site'
 defaultContentLanguage = 'en'
 
 [languages.en]
-baseURL = 'http://localhost:1313/'
 languageName = 'English'
 title = 'In English'
 weight  = 1
 [languages.fr]
-baseURL = 'http://localhost:1313/fr'
 languageName = 'Français'
 title = 'French'
 weight  = 2

HI @jmooring : Thank you for your response. I tried what you just sent over but doesn’t work. I get errors, hugo server doesn’t work. What is the easiest way to go about doing multilanguage sites. The documentation is so confusing in line with this. I tried everything there but doesn’t work. I also read through a few materials online - tried the Content Dir options - same issues.

what is the relationship between menu and the language? I have [languages] and [menu] - English works but the index.fr.md doesn’t.

How to Make a Multilingual Website with Hugo - This material worked but I don’t know why I have to write all the menu in [languages.en.menu], [languages.fr.menu].

Can you share your repository?

You did the first part, but not the second. When you see a diff file like I posted above, a minus sign at the beginning indicates the line has been deleted, while a plus sign indicate the line has been added.

You didn’t delete the lines; you pasted the diff.

Next, details matter. When the documentation shows this:

[languages]

Don’t do this:

[Languages]

Please read the TOML documentation to understand important syntax details such as:

  • How to represent numbers (no quotes)
  • How to represent boolean values (no quotes)
  • When you can omit a table name (when there’s a sub-table)
Here's a clean site configuration file
baseURL = 'https://example.org/'
languageCode = 'en-us'
title = 'My New Hugo Site'
defaultContentLanguage = 'en'

[languages.en]
languageName = 'English'
title = 'In English'
weight  = 4
languagedirection = 'rtl'

[languages.fr]
languageName = 'Français'
title = 'French'
weight = 5

[[menu.navmenu]]
identifier = 'basicinsight'
name = 'Basic Insight'
pageref = '/basic-insight'
weight = 1

[[menu.navmenu]]
identifier = 'Analyses'
name = 'analyses'
pageref = '/analyses'
weight = 2

[[menu.navmenu]]
identifier = 'blog'
name = 'blog'
pageref = '/blog'
weight = 3

[params]
logo = '/images/core-cognition-logo.svg'
alt = 'asds'
url = '/'
favicon = ''
blogpostId = '619f99a4cb879275fad566e6'
dataId = '61996b3541cc105c084a9af1'

[taxonomies]
tag = 'tags'
category= 'categories'
author = 'authors'

Finally, the Analyses section is still in draft mode. See:
content/analyses/_index.md

1 Like

You also have several deprecated constructs. Please replace .URL with either .RelPermalink or .Permalink

When I replace .URL with .Permalink or .RelPermalink I get errors. The documentation for Menu still states URL on the config file. I also tried changing the config - URL to permalink - Errors.

can’t evaluate field RelPermalink in type *navigation.MenuEntry

I my previous post I pointed to 3 places, and 3 places only, to make the change.

I suspect you changed it somewhere else too.