Skip to content

multilingual: Shared resource discarded if same bundle does not exist in default content language #12107

@jmooring

Description

@jmooring

Similar to #12079, but there's no ambiguity in this case: we should not discard the page resource.

Below, en is the default content language.

content/
└── s1/
    ├── p1/
    │   ├── a.txt
    │   └── index.de.md  <-- non-default content language, no matching bundle in english
    ├── _index.de.md
    └── _index.en.md

Expected (v0.122.0)

public/
├── de/
│   ├── s1/
│   │   ├── p1/
│   │   │   ├── a.txt      <-- this is missing in v0.123.1 see below
│   │   │   └── index.html
│   │   └── index.html
│   └── index.html
├── en/
│   ├── s1/
│   │   └── index.html
│   └── index.html
└── index.html

Actual (v0.123.1)

public/
├── de/
│   ├── s1/
│   │   ├── p1/
│   │   │   └── index.html
│   │   └── index.html
│   └── index.html
├── en/
│   ├── s1/
│   │   └── index.html
│   └── index.html
└── index.html
failing test case
func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
disableKinds = ['rss','sitemap','taxonomy','term']
defaultContentLanguage = 'en'
defaultContentLanguageInSubdir = true
[languages.en]
[languages.de]
-- layouts/_default/single.html --
{{ .RelPermalink }}
-- layouts/_default/list.html --
{{ .RelPermalink }}
-- content/s1/_index.de.md --
---
title: s1 (de)
---
-- content/s1/_index.en.md --
---
title: s1 (en)
---
-- content/s1/p1/index.de.md --
---
title: s1/p1 (de)
---
-- content/s1/p1/a.txt --
irrelevant
`

	b := hugolib.Test(t, files)

	b.AssertFileExists("public/de/s1/index.html", true)
	b.AssertFileExists("public/de/s1/p1/index.html", true)
	b.AssertFileExists("public/de/s1/p1/a.txt", true) // failing test

	b.AssertFileExists("public/en/s1/index.html", true)
	b.AssertFileExists("public/en/s1/p1/index.html", false)
	b.AssertFileExists("public/en/s1/p1/a.txt", false)
}

References:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions