fix: replace deprecated .Site.AllPages usage#928
fix: replace deprecated .Site.AllPages usage#928abhijeetnardele24-hash wants to merge 3 commits intolayer5io:masterfrom
Conversation
Signed-off-by: abhijeet nardele <234410808+abhijeetnardele24-hash@users.noreply.github.com>
✅ Deploy Preview for bejewelled-pegasus-b0ce81 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
layouts/_default/sitemap.xml
Outdated
| <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" | ||
| xmlns:xhtml="http://www.w3.org/1999/xhtml"> | ||
| {{ range .Site.AllPages }} | ||
| {{ range site.AllPages }} |
There was a problem hiding this comment.
@abhijeetnardele24-hash I think this is not correct. Please read docs of hugo.
There was a problem hiding this comment.
wait let me check i was in hurry
Signed-off-by: abhijeet nardele <234410808+abhijeetnardele24-hash@users.noreply.github.com>
|
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. |
|
@abhijeetnardele24-hash I'm still observing issue. you can check by running |
There was a problem hiding this comment.
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.AllPagesiteration inlayouts/_default/sitemap.xml. - Adds nested iteration over
hugo.Sitesand each site’s.Pages.
| {{ range hugo.Sites }} | ||
| {{ range .Pages }} |
There was a problem hiding this comment.
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.
| <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" | ||
| xmlns:xhtml="http://www.w3.org/1999/xhtml"> | ||
| {{ range .Site.AllPages }} | ||
| {{ range hugo.Sites }} |
There was a problem hiding this comment.
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.
Summary
Testing
Closes #925