Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sitemap index points to itself in monolingual config with defaultContentLanguageInSubdir = true #12266

Closed
jmooring opened this issue Mar 15, 2024 · 1 comment · Fixed by #12267

Comments

@jmooring
Copy link
Member

jmooring commented Mar 15, 2024

Reference: https://discourse.gohugo.io/t/sitemap-in-single-language-website-with-en-prefix/48861

This isn't anything new.

site configuration

baseURL = 'https://example.org/'
title = 'Hugo Forum Topic #48861'
disableKinds = ['rss','taxonomy','term']
defaultContentLanguageInSubdir = true

content

content/
└── _index.md

published

public/
├── en/
│   ├── index.html
│   └── sitemap.xml
├── index.html
└── sitemap.xml  <-- this is a sitemapindex, but it points to itself

The sitemapindex should point to https://example.org/en/sitemap.xml instead of pointing to itself.

failing test

func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
baseURL = 'https://example.org/'
disableKinds = ['page','rss','section','taxonomy','term']
defaultContentLanguageInSubdir = true
-- content/_index.md --
---
title: home
---
  `
	b := hugolib.Test(t, files)

	b.AssertFileExists("public/sitemap.xml", true)
	b.AssertFileExists("public/en/sitemap.xml", true)

	b.AssertFileContent("public/sitemap.xml", "<loc>https://example.org/en/sitemap.xml</loc>")
	b.AssertFileContent("public/en/sitemap.xml", "<loc>https://example.org/en/</loc>")
}
@jmooring jmooring self-assigned this Mar 15, 2024
jmooring added a commit to jmooring/hugo that referenced this issue Mar 15, 2024
bep pushed a commit that referenced this issue Mar 16, 2024
bep added a commit to bep/hugo that referenced this issue Mar 16, 2024
It's not in use and after gohugoio#12266 it's also not corret to use on its own (use .Site.Home.Permalink).
bep added a commit that referenced this issue Mar 16, 2024
It's not in use and after #12266 it's also not corret to use on its own (use .Site.Home.Permalink).
Copy link

github-actions bot commented Apr 7, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant