defaultContentLanguageInSubDir = 'false' not working?

Hi,
Maybe I am doing something wrong.
I added additional language to my site and deployed to Netlify to discover, that main language is not longer in /root/ but in language folder and thats breaking all (I revert the change).

I have checked locally and run Hugo.
In public directory all languages are generated in folders, where default language shall be in root and only additional in folder.

I read that defaultContentLanguageInSubDir = ‘false’ is by default so don’t need to specify, but it doesn’t seams to work, as both languages are generated in folders.

Any idea why? and how to sort this?

Please post your configuration file.

baseURL = "https://dariusz.wieckiewicz.org/"
assetDir = "content"
canonifyURLs = 'true'
RemovePathAccents = 'true'
preserveTaxonomyNames = 'false'
DefaultContentLanguage = "pl-pl"

[outputs]
page = [ "HTML"]
home = [ "HTML", "RSS"]

[languages]
  [languages.pl-pl]
    baseURL = "https://dariusz.wieckiewicz.org/"
    title = "Dariusz Więckiewicz"
    description = "Wolny świat, wolne myśly, wolne słowa..."
    languageName = "Polish"
    weight = "1"
    languageCode = "pl-pl"
    PaginatePath = "strona"
    [languages.pl-pl.permalinks]
    tags = "/tag/:slug/"
    categories = "/kategoria/:slug/"
    authors = "/autor/:slug/"

    [languages.pl-pl.menu]
    [[languages.pl-pl.menu.main]]
      identifier = "giffgaff"
      name = "GiffGaff – odbierz swoje £5"
      url = "/giffgaff/"
      weight = 1
    [[languages.pl-pl.menu.main]]
      identifier = "transferwise"
      name = "Wise – przelej £500 za darmo"
      url = "/wise/"
      weight = 2
    [[languages.pl-pl.menu.main]]
      identifier = "monzo"
      name = "Monzo"
      url = "/monzo/"
      weight = 3
    [[languages.pl-pl.menu.main]]
      identifier = "quidco"
      name = "Quidco – odbierz swoje £10"
      url = "/quidco/"
      weight = 4

    [[languages.pl-pl.menu.footer]]
      identifier = "o"
      name = "O mnie"
      url = "/o/"
      weight = 1
    [[languages.pl-pl.menu.footer]]
      identifier = "kontakt"
      name = "Kontakt"
      url = "/kontakt/"
      weight = 2

  [languages.en]
    baseURL = "https://dariusz.wieckiewicz.org/en/"
    title = "Dariusz Więckiewicz"
    description = "Free world, free thoughts, free words..."
    languageName = "English"
    weight = "2"
    languageCode = "en-gb"
    PaginatePath = "page"
    [languages.en.permalinks]
      tags = "/tag/:slug/"
      categories = "/category/:slug/"
      authors = "/author/:slug/"

    [languages.en.menu]
      [[languages.en.menu.main]]
        identifier = "about"
        name = "About Me"
        url = "/about/"
        weight = 1
      [[languages.en.menu.main]]
        identifier = "contact"
        name = "Contact"
        url = "/contact/"
        weight = 2

      [[languages.en.menu.footer]]
        identifier = "about"
        name = "About Me"
        url = "/about/"
        weight = 1
      [[languages.en.menu.footer]]
        identifier = "contact"
        name = "Contact"
        url = "/contact/"
        weight = 2

[params]
  author = "Dariusz Więckiewicz"
  header = "Dariusz Więckiewicz"
  twitter = "@dariusz_w"
  facebook = "https://facebook.com/dariusz.wieckiewicz"
  logo = "svg/dariusz-wieckiewicz-logo.svg"
  logorss = "png/dariusz-wieckiewicz-logo.png"
  facebook_url = 'dariusz.wieckiewicz'
  twitter_url = 'dariusz_w'
  linkedin_url = 'wieckiewicz'
  instagram_url = 'dariusz.wieckiewicz'
  github_url = "idarek"
  youtube = "ITDarek"

[author]
    name = "Dariusz Więckiewicz"

[related]
  threshold = 80
  includeNewer =  true
  toLower =  true
 [[related.indices]]
  name = "tags"
  weight =  100

 [[related.indices]]
  name = "date"
  weight = 10

[markup]
  [markup.goldmark]
    [markup.goldmark.renderer]
      unsafe = "true"

[privacy]
  [privacy.youtube]
     disable = "false"
     privacyEnhanced = "true"

To avoid questions, Polish language is specified as pl-pl and not pl in relation to raised issue #8452

Please post the netlify.toml file as well. Thanks.

[build]
 publish = "public"
 command = "hugo --gc --minify"

[context.production.environment]
 HUGO_VERSION = "0.82.1"
 HUGO_ENV = "production"
 HUGO_ENABLEGITINFO = "false"

[context.split1]
 command = "hugo --gc --minify"

[context.split1.environment]
 HUGO_VERSION = "0.82.1"
 HUGO_ENV = "production"

[context.deploy-preview]
 command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"

[context.deploy-preview.environment]
 HUGO_VERSION = "0.82.1"

[context.branch-deploy]
 command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"

[context.branch-deploy.environment]
 HUGO_VERSION = "0.82.1"

[context.next.environment]
 HUGO_ENABLEGITINFO = "false"

ps. Personally don’t think it got anything to do with Netlify.

When got only single language, all posts are generated in root directory /public/

With multilanguage, default language shall be generated in /public/ and other in folder /public/en/

but, root directory is clear and all languages are generated in folders /public/pl-pl/ /public/en/` despite that Default content language is not specified to be in sub directory.

I found some old issue, maybe this is something to do with that #2422

I think I find whats the issue.
When in [languages] there is specified baseURL (in each language).
By default this shall be used to serve in different domains and not in main domain but different subfolder.

In my case I revert to baseURL to be on top of everything, and then default content is generated in root and other in subfolder (than control by defaultContentLanguageInSubDir can be used when needed).

Think I misunderstood Configure Multilingual Multihost as this is for multi host - different domain, not for subfolder use.

Although not related to your problem, I noticed this in your syntax:

canonifyURLs = 'true'
RemovePathAccents = 'true'
preserveTaxonomyNames = 'false'

You don’t want to use quotes with boolean values. Do this instead:

canonifyURLs = true
RemovePathAccents = true
preserveTaxonomyNames = false

When Hugo reads the predefined site and page parameters, it guesses your intention and converts these strings to booleans, so it is not causing a problem. But you will not get the expected results with custom parameters, at either the site or page level.

config.toml

[params]
foo = 'false'

layouts/_default/single.html

{{ if site.Params.foo }}
  site.Params.foo is true
{{ else }}
  site.Params.foo is false
{{ end }}

Result:

site.Params.foo is true

Thank you. Will change.

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