I18n and layout probleme

Hi
I made a Hugo project that works well and now I want to internationalize it.
I created a “languages” entry in my config.toml, like this:

DefaultContentLanguage = "fr"

[languages]
  [languages.fr]
	  languageName = "Français"
    title = "Page perso de : "
    contentDir = "content/French"
	  weight = 1
  [languages.en]
	  languageName = "English"
    title = "Personal page of : "
    contentDir = "content/English"
	  weight = 2

In my “content” folder I created 2 subfolders: “French” and “English” with a file “_index.md” and a “page” folder containing my different contents.

Content
 ├──   French
  |          ├── _index.md
  |          └── Page
  |                   ├── teaching.md
  |                   └── publications.md
 └── English
            ├── _index.md
            └── Page
                    ├── teaching.md
                    └── publication.md

But when I save and the server updates the rendering, I get the error:

found no layout file for “HTML” for kind “home”

Before to do the I18n, I didn’t have this problem.

This portion of your site configuration is valid.

Can you post a link to the public repository for your project?

See https://discourse.gohugo.io/t/requesting-help/9132.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Thank you for your help JMooring.

this is the link to my project reposirory

Of course, in this repository, I have removed this part of the code:

DefaultContentLanguage = "fr"

[languages]
  [languages.fr]
	  languageName = "Français"
    title = "Page perso de : "
    contentDir = "content/French"
	  weight = 1
  [languages.en]
	  languageName = "English"
    title = "Personal page of : "
    contentDir = "content/English"
	  weight = 2

in my config.toml ,to be able to continue working.

I have a clue!
In my config.toml, the line:

theme = "pages-IMB-theme"

was after:

DefaultContentLanguage = "fr"

[languages]
  [languages.fr]
	  languageName = "Français"
    title = "Page perso de : "
    contentDir = "content/French"
	  weight = 1
  [languages.en]
	  languageName = "English"
    title = "Personal page of : "
    contentDir = "content/English"
	  weight = 2

If I put this line before, the pages are rendered (no more error) but on the English page (with the URL ending with /en/ ) my CSS does not apply. :sob:

Either push your changes, or show me the entire config.toml. Thanks.

Sorry I forgot to push my last config.toml modification. It’s done now.

It is not my CSS that does not apply to English pages, it is Boostrap. So I redid the Bootstrap links in my Head.

	{{ $bootstrapcss := resources.Get "libs/bootstrap.min.css" }}
  	{{ $js := $bootstrapcss | resources.Minify }}
	<link rel="stylesheet" href="{{$bootstrapcss.RelPermalink}}">

	{{ $bootstrapjs := resources.Get "libs/bootstrap.bundle.min.js" }}
  	{{ $js := slice $bootstrapjs | resources.Concat "libs/bundle.js" | resources.Minify }}
  	<script src="{{$js.RelPermalink}}" defer></script>

Please clean it up and try again.

image

Also, remove contentDir from the root table. This is specified on a per language basis.

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