I created content/en/test.md now how can I see it online?

This is my first day using Hugo.

I followed the Quick Start successfully. Then I created content/en/ and content/fr/ to make the site bilingual. I can access the index.md files in each of these directories via localhost:1313/en/ and localhost:1313/fr/.

But I can’t access any other pages, e.g. content/en/test.md is not seen at localhost:1313/en/test. Based on the instructions for multilingual sites, I understand it should work, though.

What am I assuming or doing wrong?

I got the answer from Directory structure | Hugo. Files are not processed unless they are placed inside directories whose name carry some semantic meaning. Lesson learned.

EDIT: The problem persists. See my reply below.

Finally, I don’t really get how multiligual sites should be organized, despite the doc.

Here is my structure:

content/
    |-- about.en.md
    |-- about.fr.md
    |-- index.en.md
    |-- index.fr.md

And here is my config.toml:

baseURL = 'localhost:1313/'
defaultContentLanguage = 'fr'
defaultContentLanguageInSubdir = true
title = "Lxxx"
theme = "hello-friend-ng"
paginate = 10

[params]
  dateform        = "Jan 2, 2006"
  dateformShort   = "Jan 2"
  dateformNum     = "2006-01-02"
  dateformNumTime = "2006-01-02 15:04"

  # Subtitle for home
  homeSubtitle = "Some text"

  # Set disableReadOtherPosts to true in order to hide the links to other posts.
  disableReadOtherPosts = false

  # Enable sharing buttons, if you like
  enableSharingButtons = true
  
  # Show a global language switcher in the navigation bar
  enableGlobalLanguageMenu = false

  # Metadata mostly used in document's head
  description = "Mon tout nouveau site web"
  keywords = "homepage, blog"
  images = [""]

[taxonomies]
    category = "blog"
    tag      = "tags"
    series   = "series"

[languages]
  [languages.fr]
    disabled = false
    languageCode = 'fr'
    languageDirection = 'ltr'
    languageName = 'Français'
    weight = 2
  [languages.fr.params]
    keywords = ""
    readOtherPosts = "Voir les autres articles"
    [languages.fr.params.logo]
      logoText = "Bienvenue sur lxxx.fr"
      logoHomeLink = "/fr"
  [languages.en]
    disabled = false
    languageCode = 'en'
    languageDirection = 'ltr'
    languageName = 'English'
    title = 'Website lxxx.fr'
    weight = 1
  [languages.en.params]
    keywords = ""
    readOtherPosts = "Read other posts"
    [languages.en.params.logo]
      logoText = "Welcome to lxxx.fr"
      logoHomeLink = "/en"

Opening http://localhost:1313/en/ and http://localhost:1313/fr/ works fine. It displays the content of the respective index.xx.md files.

However http://localhost:1313/en/about and http://localhost:1313/fr/about return Page not found.

According to this specific section in the doc, it should work.

I am obviously missing something very obvious, but what?

First: I am very new so take everything with a lot of salt :wink: But I am stuck with something multi-language right now, so I may know your problem.

First of all, there are 2 options for multi-language.

First is a directory for every language. That’s what you wrote in your first post.
However, in your third post you seem to be using the second option: having the same file with the language added in the same directory.

If you are using the second option, you need
defaultContentLanguageInSubdir= false
in your config. (default, for subdirectories, is true)

Thanks Lenn. You are right that I moved from directory-based translations to file-based translations.

I changed the flag as you pointed out. I have new errors now that I need to investigate.

I am trying to adapt this very simple example. And even it doesn’t work. Maybe an issue with the theme I am using.

I found the issue. Hugo changes its behaviour dramatically depending on whether a directory contains an index.md file or not. The serving of other md files goes from works fine to completely broken.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.