Skip to content

[Docs] Resolve .Site.AllPages deprecation#120

Open
Junnygram wants to merge 1 commit intolayer5io:masterfrom
Junnygram:fix/deprecate-all-pages
Open

[Docs] Resolve .Site.AllPages deprecation#120
Junnygram wants to merge 1 commit intolayer5io:masterfrom
Junnygram:fix/deprecate-all-pages

Conversation

@Junnygram
Copy link
Copy Markdown

I have successfully investigated and resolved the Hugo deprecation warning for .Site.AllPages in github.com/layer5io/academy-example.

Issue Investigation

The deprecation of .Site.AllPages in Hugo v0.156.0 causes build warnings and future breakage. This global accessor is being replaced by the more modern hugo.Sites and .Pages approach, which better handles multi-site and multi-language setups. Our investigation revealed that while the property wasn't directly used in academy-example, it was inherited from the Docsy theme via the offline search index and default sitemap.

Actions Taken

I have implemented the fix by overriding the offending templates and updating configuration:

  1. Created assets/json/offline-search-index.json: Overrode the Docsy search index logic with a modern Hugo-compliant version that uses range hugo.Sites to iterate through all pages across all sites.
    1. Created layouts/_default/sitemap.xml: Overrode the default sitemap template using the same fixed iteration pattern (verified against a similar fix in the layer5io/docs repository).
    1. Updated hugo.yaml: Bumped the minimum Hugo version to 0.156.0 to ensure compatibility with the hugo.Sites accessor and avoid future deprecation warnings.
      Notes for Reviewers
      This PR fixes [Docs] deprecated: .Site.AllPages #108
      Signed commits
  • Yes, I signed my commits.

Signed-off-by: Junnygram <junnexclusive@gmail.com>
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

1 participant