Repository navigation
Add Content Signals to the generated robots.txt - #189
Merged
Merged
Conversation
Let users set the search, ai-input and ai-train Content Signals in the SEO settings. The worker adds a Content-Signal line to the robots.txt group for all crawlers, creating that group if the custom rules have none. A separate group could hide the user's rules from parsers that only read the first matching group. Closes #187 Co-Authored-By: Claude Opus 5.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.
Summary
Closes #187.
Adds three selects under SEO & AI Attribution:
search,ai-inputandai-train, each with the options not set, yes and no. A caption links to contentsignals.org. It also says that compliance is voluntary and that blocking crawlers needs AI Crawl Control.The generated worker gets a
CONTENT_SIGNALconfig constant, for example"search=yes, ai-train=no". The value is built at generation time in a fixed order, and values other thanyes/noare dropped.robots.txtaddsContent-Signal: ...to the group for all crawlers:User-agent: */Content-Signal: .../Allow: /.User-agent: *group, the line goes into that group, after any user-agent lines that follow it.User-agent: *group with the signal comes first.The signal is added to the existing group rather than as a separate one, because a separate
*group could hide the user's rules from parsers that only read the first matching group.When no signal is set,
robots.txtis unchanged.Not included: sending the same value as a
Content-Signalresponse header, mentioned as optional in #187. That header only matters for Markdown for Agents conversions, which need #185 first, so it can follow later.Verification
npm test: 16 tests pass, including four new ones forrobots.txt:*group, which has a second user-agent line*groupnpm run buildsucceeds.search=yesandai-train=no, the copied script containsconst CONTENT_SIGNAL = "search=yes, ai-train=no";.