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.xml not generated when content contains sitemap directory #12183

Closed
jmooring opened this issue Feb 29, 2024 · 3 comments
Closed

sitemap.xml not generated when content contains sitemap directory #12183

jmooring opened this issue Feb 29, 2024 · 3 comments

Comments

@jmooring
Copy link
Member

jmooring commented Feb 29, 2024

content/
└── sitemap/
    └── index.md  <-- type = sitemap

layouts/
├── _default/
│   └── single.html
└── sitemap/
    └── single.html

Expected (v0.122.0)

public/
├── sitemap/
│   └── index.html
└── sitemap.xml

Actual (v0.123.6)

public/
└── sitemap/
    └── index.html
Failing test case
func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
disableKinds = ['home','rss','section','taxonomy','term']
-- layouts/_default/single.html --
layouts/_default/single.html
-- layouts/sitemap/single.html --
layouts/sitemap/single.html
-- content/sitemap/index.md --
---
title: My sitemap
type: sitemap
---
`

	b := hugolib.Test(t, files)

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

Reference: https://discourse.gohugo.io/t/don-t-name-a-folder-sitemap/48580

brycewray added a commit to brycewray/hugo-site that referenced this issue Mar 1, 2024
@bep bep added NotSure and removed NeedsTriage labels Mar 1, 2024
@bep bep added this to the v0.123.7 milestone Mar 1, 2024
@bep
Copy link
Member

bep commented Mar 1, 2024

The thing is:

  • Before Hugo 0.123.0, these "standalone" pages (sitemap, 404, ...) lived a separate life with special handling.
  • In 0.123.0 they have a Kind and they are stored in the same tree structure as the other pages, and they are rendered in the same loop as the rest.
  • This means that the sitemap gets assigned the logical path /sitemap.
  • If you add content that also resolves to the /sitemap path, you effectively turn off sitemap.

I understand that sitemap may be a common section, and I'm open to suggestions as to improving this without messing with the general concept above.

@bep bep modified the milestones: v0.123.7, v0.124.0 Mar 1, 2024
@bep
Copy link
Member

bep commented Mar 1, 2024

OK, thinking about this, I think we can easily fix this by making the path for the sitemap into something more distinct. I will fix it.

@bep bep modified the milestones: v0.124.0, v0.123.6, v0.123.7 Mar 1, 2024
@bep bep removed the NotSure label Mar 1, 2024
bep added a commit to bep/hugo that referenced this issue Mar 1, 2024
@bep bep closed this as completed in 9dfa9e7 Mar 1, 2024
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 Mar 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants