Skip to content

[3.x] Support pages with more output file extensions (Add a robots.txt generator)#2531

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

[3.x] Support pages with more output file extensions (Add a robots.txt generator)#2531
emmadesilva merged 7 commits into
v3/non-html-pagesfrom
v3/non-html-pages-robots

Conversation

@emmadesilva

Copy link
Copy Markdown
Member

What was built

Hyde now generates a robots.txt out of the box, wired exactly like the PR 5 sitemap/RSS pages:

  • RobotsTxtPage extends InMemoryPage and a container-resolved RobotsTxtGenerator, in a new Hyde\Framework\Features\TextGenerators namespace mirroring XmlGenerators (outside Hyde\Pages, so it's exempt from the page unit-test contract). Default output is User-agent: * / Allow: /, plus a Sitemap: line when Features::hasSitemap().
  • Config: hyde.robots.enabled (default on) and hyde.robots.disallow (paths written verbatim as Disallow: rules, replacing the Allow: / line). Added to both config stubs.
  • Features::hasRobotsTxt() gates registration in HydeCoreExtension::discoverPages() with the D5 skip check. Notably it needs no site URL (robots directives are relative); the only absolute URL is the Sitemap line, gated by the same hasSitemap() condition that registers the sitemap page — the GlobalMetadataBag no-drift precedent.

Verification

  • New coverage: registration/disable, generator output shapes, container rebind, real build command output, build manifest, route:list, sitemap self-exclusion, realtime-compiler serving with text/plain, and the D5-mandated end-to-end override tests (booting callback and extension both suppress the generated page) — the epic flagged these as mandatory for PR 6.
  • Because the page registers unconditionally on default config, five existing tests asserting exact collections gained a hyde.robots.enabled => false in their setup, alongside their existing sitemap/RSS switches. One subtlety from the run: a count-assertion failure mid-PageCollectionTest deleted the tracked default Blade pages before restoreDefaultPages() could run, which cascaded into ~10 misleading build-test failures until I restored _pages/ from git.
  • All four suites were baseline-compared per the CLAUDE.md procedure (run at HEAD, re-run with packages reverted, diff sorted FAILED lines): identical failure lists on FeatureFramework, UnitFramework, and FeatureHyde (remaining failures are the known environmental ones); Realtime Compiler fully green. HydeStan reports no errors.

Commits (5, atomic)

Implementation → existing-test adaptations → new tests → release notes/UPGRADE.md → epic update. The epic's PR 6 section is marked ✅ Implemented with notes recording the decisions: the TextGenerators namespace (with a pointer that PR 7's llms.txt should land there as LlmsTxtGenerator/LlmsTxtPage), the no-site-URL feature gate, verbatim disallow rules (no leading-slash normalization — it would break wildcards and the valid empty rule), and the decision not to add a build:robots command since, unlike sitemap/RSS, there's no removed task to stay compatible with.

emmadesilva and others added 5 commits July 13, 2026 23:14
Registers a RobotsTxtPage in the core extension per the non-HTML pages epic
(PR 6): all crawlers allowed by default, Disallow rules from the new
hyde.robots.disallow config, and a Sitemap link when the sitemap feature is
enabled. The contents come from a container-resolved RobotsTxtGenerator in a
new TextGenerators namespace mirroring XmlGenerators, and the page can be
disabled with hyde.robots.enabled or replaced by a user-defined page under
the same route key.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The tests asserting exact page and route collections, route list output, or
build manifest contents already disable the sitemap and RSS pages in their
setup; they now disable the robots.txt page the same way.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Covers registration through the core extension, the config disable switch,
generator output shapes (disallow rules, sitemap line), the container rebind
tier, compilation through the real build command, build manifest and route
list presence, both user-defined page override paths, and serving through
the realtime compiler with the text/plain 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>
@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 (37d3c96) to head (cd348f9).
⚠️ Report is 1 commits behind head on v3/non-html-pages.

Additional details and impacted files
@@                  Coverage Diff                  @@
##             v3/non-html-pages     #2531   +/-   ##
=====================================================
  Coverage               100.00%   100.00%           
- Complexity                1746      1760   +14     
=====================================================
  Files                      175       177    +2     
  Lines                     4360      4395   +35     
=====================================================
+ Hits                      4360      4395   +35     

☔ 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 and others added 2 commits July 13, 2026 23:30
Each hyde.robots.disallow entry now fails fast with an
InvalidConfigurationException naming the config key and offending index when
it is not a string, instead of surfacing as a PHP-level type coercion or
failure inside the generation callback. Values themselves stay verbatim per
the epic's decision: no trimming, slash prepending, or empty-string removal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The config stubs, generator docblock, and release note now describe
hyde.robots.disallow entries as verbatim Disallow rule values with a wildcard
pattern example, so the supported contract is discoverable from the config
file alone. Also drops a narrating comment from the core extension and
records the string-only validation contract in the epic.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@emmadesilva emmadesilva merged commit 0c9e20d into v3/non-html-pages Jul 13, 2026
7 checks passed
@emmadesilva emmadesilva deleted the v3/non-html-pages-robots branch July 13, 2026 21:56
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