Skip to content

[3.x] Support pages with more output file extensions (Convert sitemap to a Hyde page)#2529

Merged
emmadesilva merged 7 commits into
v3/non-html-pagesfrom
v3/non-html-pages-convert-sitemap
Jul 13, 2026
Merged

[3.x] Support pages with more output file extensions (Convert sitemap to a Hyde page)#2529
emmadesilva merged 7 commits into
v3/non-html-pagesfrom
v3/non-html-pages-convert-sitemap

Conversation

@emmadesilva

Copy link
Copy Markdown
Member

What changed:

  • New SitemapPage extends InMemoryPage (Framework/Features/XmlGenerators/SitemapPage.php) whose compile() resolves SitemapGenerator from the container, so a container rebind swaps the output (verified by test — the generator is not final and has no constructor dependencies).
  • Registered in HydeCoreExtension::discoverPages() behind Features::hasSitemap(), skipping when a page already claims the sitemap.xml route key (D5). Verified end-to-end that user pages win via both a booting() callback (visible to the skip check, which runs after booting callbacks) and a user HydeExtension (runs after core, replaces the page under the same collection key).
  • GenerateSitemap removed (not deprecated — a kept task would double-generate) and dropped from BuildTaskService; build:sitemap now builds the registered route's page via StaticPageBuilder, falling back to new SitemapPage() so the explicit command still works when generate_sitemap is disabled. The no-base-URL failure now exits 1 instead of 3.

Epic decisions resolved and written back: D4's deferred plain-page-vs-subclass call went to the thin subclass — the command's fallback instantiation is exactly the concrete need the epic anticipated, mirroring BuildSearchCommand/DocumentationSearchIndex. Also recorded: the D2 allowlist confirmation for sitemap.xml, the D5 ordering semantics, and part B notes (mirror with RssFeedPage; the BuildTaskServiceUnitTest fixtures were migrated to GenerateBuildManifest so removing the RSS task won't churn them again).

Verification: New SitemapPageTest (11 tests) covers registration gating, build-manifest and route:list presence, self-exclusion, rebind, and both override paths; a realtime-compiler test confirms hyde serve returns the sitemap with application/xml. Full regression protocol ran clean: Unit and Feature suite FAILED lists are identical to the pre-change baseline (the ~40/51 remaining failures are the documented environmental PHP 8.5 asset/FeaturedImage set), FeatureHyde and Realtime Compiler suites fully pass, and HydeStan found no errors. One real fallout the suite caught: the monorepo's .env sets a site URL, so tests asserting exact default collections (PageCollectionTest, RouteCollectionTest, RouteListCommandTest) now saw the sitemap route — they disable the sitemap in setUp() to stay focused on collection mechanics. Release notes and an UPGRADE.md step (with the rebind/override migration paths) are included.

emmadesilva and others added 7 commits July 13, 2026 20:27
The sitemap is now a route: registered as an in-memory page behind
Features::hasSitemap(), compiled through the standard build, and skipped
when a user-defined page already claims the sitemap.xml route key.
The contents resolve the SitemapGenerator from the service container at
compile time so the implementation can be swapped with a container rebind.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Removes the GenerateSitemap post-build task now that the sitemap page is
compiled through the standard build, and rewires the build:sitemap command
to build the registered page (or a new instance when the route is not
registered, preserving the ability to explicitly generate the sitemap
when it is disabled in the configuration) through the StaticPageBuilder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Covers the feature-gated route registration, compilation through the build
command including build manifest and route list presence, the container
rebind customization tier, user-defined pages suppressing the generated
page through both booting callbacks and extensions, and the realtime
compiler serving sitemap.xml with the XML content type.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
These tests assert the exact contents of a default project's page and route
collections, which now include the sitemap page since the monorepo test
environment configures a site URL. The sitemap route registration itself
is covered by SitemapPageTest.

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

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (64d074e) to head (c02bf70).

Additional details and impacted files
@@                  Coverage Diff                  @@
##             v3/non-html-pages     #2529   +/-   ##
=====================================================
  Coverage               100.00%   100.00%           
- Complexity                1738      1742    +4     
=====================================================
  Files                      175       175           
  Lines                     4340      4349    +9     
=====================================================
+ Hits                      4340      4349    +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@emmadesilva emmadesilva merged commit 205fea8 into v3/non-html-pages Jul 13, 2026
8 checks passed
@emmadesilva emmadesilva deleted the v3/non-html-pages-convert-sitemap branch July 13, 2026 19:10
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