Skip to content

[3.x] Support pages with more output file extensions (Sitemap inclusion policy)#2528

Merged
emmadesilva merged 8 commits into
v3/non-html-pagesfrom
v3/non-html-pages-sitemap-inclusion-policy
Jul 13, 2026
Merged

[3.x] Support pages with more output file extensions (Sitemap inclusion policy)#2528
emmadesilva merged 8 commits into
v3/non-html-pagesfrom
v3/non-html-pages-sitemap-inclusion-policy

Conversation

@emmadesilva

Copy link
Copy Markdown
Member

What changed:

  • HydePage::showInSitemap() (packages/framework/src/Pages/Concerns/HydePage.php:412) reads the sitemap front matter key, defaulting to whether the resolved output path ends in .html — honoring the D3 constraint to use getOutputPath() rather than the static outputExtension(), so an InMemoryPage('robots.txt') self-excludes despite statically reporting .html. Front matter wins both ways, so sitemap: true can opt a non-HTML page in.
  • SitemapGenerator::generate() now filters on showInSitemap() instead of instanceof Redirect, fixing the production search.json leak.
  • Redirect overrides the method to return false unconditionally, mirroring its showInNavigation(). This is a small refinement of D3's "defaults false for redirects" (no front-matter opt-in), which I recorded in the epic — it matches the existing release note that redirect routes are intrinsically excluded, and redirects in sitemaps are an SEO anti-pattern anyway.

Tests: testShowInSitemap joined the BaseHydePageUnitTest contract and all six page unit tests. Two existing tests asserted the leak as expected behavior and were flipped: SitemapServiceTest now asserts the docs search page stays while the search index is excluded, and SitemapFeatureTest's expected XML dropped its docs/search.json entry and gained a sitemap: false page exercised through the real build:sitemap command. NonHtmlPageOutputTest got an end-to-end guard: a registered robots.txt page built by the real build command is asserted absent from the built sitemap — the exact regression the D3 note warns about.

Docs: Release notes in HYDEPHP_V3_PLANNING.md cover the new feature and the bugfix; the epic's D3 and PR 4 sections are marked ✅ Implemented with notes. No UPGRADE.md entry — the fix requires no user action, and nothing realistic depended on search indexes appearing in sitemaps.

emmadesilva and others added 4 commits July 13, 2026 19:40
Replaces the instanceof Redirect filter in SitemapGenerator with a
HydePage::showInSitemap() method backed by the sitemap front matter key,
defaulting to false for pages whose resolved output path is not HTML.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…indexes

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@emmadesilva emmadesilva changed the base branch from 2.x to v3/non-html-pages July 13, 2026 17:52
@emmadesilva emmadesilva marked this pull request as ready for review July 13, 2026 17:52
emmadesilva and others added 4 commits July 13, 2026 20:08
(bool) cast treated quoted string values like "false" as truthy,
silently including pages meant to be excluded from the sitemap.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@emmadesilva emmadesilva force-pushed the v3/non-html-pages-sitemap-inclusion-policy branch from 2b6034a to db53aae Compare July 13, 2026 18:09
@emmadesilva emmadesilva merged commit 64d074e into v3/non-html-pages Jul 13, 2026
6 checks passed
@emmadesilva emmadesilva deleted the v3/non-html-pages-sitemap-inclusion-policy branch July 13, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant