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 file name not changing when custom filename is specified #12525

Closed
jluiz20 opened this issue May 22, 2024 · 3 comments · Fixed by #12529
Closed

sitemap file name not changing when custom filename is specified #12525

jluiz20 opened this issue May 22, 2024 · 3 comments · Fixed by #12529

Comments

@jluiz20
Copy link

jluiz20 commented May 22, 2024

If I am not doing anything wrong, it seems that the newer version is not generating a sitemap with a custom name. I have copied the configuration from the docs and changed the filename but it is always generating the sitemap with the default sitemap.xml name.

this is my config
image

and when I run hugo to build the site, the sitemap in the public folder is sitemap.xml instead of the sitemap-1.xml in the configuration.

image

I know it was working in some versions ago, but I am not sure which one it was working. Also, I can be misconfiguring stuff, so I am sorry I am doing something wrong.

What version of Hugo are you using (hugo version)?

hugo version

 v0.126.1+extended

Does this issue reproduce with the latest release?

yes

Thank you for the great project! I love hugo <3

@jmooring
Copy link
Member

jmooring commented May 22, 2024

This worked in v0.122.0 and earlier.

When using a custom filename with a multilingual site, the sitemapindex links include the custom filename, but the files themselves do not, resulting in a broken sitemapindex.

Failing test:

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

	files := `
-- hugo.toml --
baseURL = 'https://example.org/'
disableKinds = ['page','rss','section','taxonomy','term']
defaultContentLanguage = 'de'
defaultContentLanguageInSubdir = true
[languages.de]
[languages.en]
[sitemap]
filename = 'foo.xml'
-- layouts/index.html --
irrelevant
`

	b := hugolib.Test(t, files)

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

	b.AssertFileContent("public/foo.xml",
		"<loc>https://example.org/de/foo.xml</loc>",
		"<loc>https://example.org/en/foo.xml</loc>",
	)
}

@jluiz20
Copy link
Author

jluiz20 commented Jun 2, 2024

Now it is working in the new version 0.126.2! Thank you @jmooring for the fix!!

Copy link

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 Jun 24, 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.

2 participants