Skip to content

fix: replace deprecated .Site.AllPages usage#928

Open
abhijeetnardele24-hash wants to merge 3 commits intolayer5io:masterfrom
abhijeetnardele24-hash:bug/abhijeetnardele24-hash/925
Open

fix: replace deprecated .Site.AllPages usage#928
abhijeetnardele24-hash wants to merge 3 commits intolayer5io:masterfrom
abhijeetnardele24-hash:bug/abhijeetnardele24-hash/925

Conversation

@abhijeetnardele24-hash
Copy link
Copy Markdown

Summary

Testing

  • targeted template update only

Closes #925

Signed-off-by: abhijeet nardele <234410808+abhijeetnardele24-hash@users.noreply.github.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 31, 2026

Deploy Preview for bejewelled-pegasus-b0ce81 ready!

Name Link
🔨 Latest commit 80cb6ab
🔍 Latest deploy log https://app.netlify.com/projects/bejewelled-pegasus-b0ce81/deploys/69cd80d99708be0008054cad
😎 Deploy Preview https://deploy-preview-928--bejewelled-pegasus-b0ce81.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Site.AllPages }}
{{ range site.AllPages }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abhijeetnardele24-hash I think this is not correct. Please read docs of hugo.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait let me check i was in hurry

Signed-off-by: abhijeet nardele <234410808+abhijeetnardele24-hash@users.noreply.github.com>
@abhijeetnardele24-hash
Copy link
Copy Markdown
Author

Updated the PR to use the Hugo-documented replacement for Site.AllPages: iterating hugo.Sites and then .Pages. Please take another look when you get a moment.

@saurabhraghuvanshii
Copy link
Copy Markdown
Member

@abhijeetnardele24-hash I'm still observing issue.
INFO deprecated: .Site.AllPages was deprecated in Hugo v0.156.0 and will be removed in a future release. See https://discourse.gohugo.io/t/56732.

you can check by running hugo --logLevel debug

Copilot AI review requested due to automatic review settings April 1, 2026 20:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the custom Hugo sitemap template to remove usage of the deprecated .Site.AllPages, addressing Hugo build warnings reported in issue #925.

Changes:

  • Replaces .Site.AllPages iteration in layouts/_default/sitemap.xml.
  • Adds nested iteration over hugo.Sites and each site’s .Pages.

Comment on lines +4 to +5
{{ range hugo.Sites }}
{{ range .Pages }}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hugo.Sites + range .Pages is not an equivalent replacement for the deprecated .Site.AllPages and can change sitemap output (e.g., excluding some page kinds that AllPages previously included). To keep behavior while removing the deprecation warning, iterate site.AllPages (or the exact intended collection, e.g. site.Pages/site.RegularPages) directly instead of switching to .Pages on each site.

Copilot uses AI. Check for mistakes.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Site.AllPages }}
{{ range hugo.Sites }}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says this replaces .Site.AllPages with site.AllPages, but the template now loops over hugo.Sites and .Pages. Please align the implementation with the stated change (or update the PR description) so reviewers know whether sitemap behavior is intended to change.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] deprecated: .Site.AllPages

3 participants