[3.x] Support pages with more output file extensions (Add a robots.txt generator)#2531
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was built
Hyde now generates a robots.txt out of the box, wired exactly like the PR 5 sitemap/RSS pages:
Verification
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.