feat(astro-seo-graph): add indexNowOnBranch for branch-gated IndexNow submission#59
Merged
Merged
Conversation
…on only on production branch Preview and feature-branch builds share the same IndexNow key as production but shouldn't notify search engines — submitting preview URLs wastes daily quota and can get the key flagged invalid (the host hasn't served those URLs yet). indexNowOnBranch(branch, options, productionBranch?) passes IndexNowIntegrationOptions through unchanged when branch matches productionBranch (default "main") and returns undefined otherwise, so seoGraph() skips submission entirely on non-production deploys. Pair with your CI platform's branch variable: - Cloudflare Pages: process.env.CF_PAGES_BRANCH - Vercel: process.env.VERCEL_GIT_COMMIT_REF - Netlify: process.env.BRANCH
…xnow # Conflicts: # packages/astro-seo-graph/README.md # packages/astro-seo-graph/src/index.ts
jdevalk
added a commit
that referenced
this pull request
Jul 7, 2026
jdevalk
added a commit
that referenced
this pull request
Jul 7, 2026
* Version Packages * docs(changelog): note indexNowOnBranch (#59) in 2.1.0 release notes --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joost de Valk <joost@altha.nl>
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.
Problem
The indexNow integration submits IndexNow submissions for every branch unconditionally. This means that platforms that deploy preview branches (Cloudflare Pages, Vercel, Netlify), will submit preview branches to IndexNow using the same key as production — URLs the production host hasn't served yet. That wastes daily quota and risks getting the key flagged invalid, forcing a rotation.
There's no built-in way to conditionalize submission; users either accept the unconditional behaviour or write their own branch-detection wrapper, which is what prompted this patch.
What This Adds
indexNowOnBranch(branch, options, productionBranch?)— a thin helper exported from@jdevalk/astro-seo-graph/integration(and re-exported from the main entry).It passes
IndexNowIntegrationOptionsthrough unchanged whenbranchmatchesproductionBranch(default"main") and returnsundefinedotherwise, soseoGraph()skips submission entirely on non-production deploys.Here is an example of usage (CloudFlare-specific):
NOTE: Existing configs that pass
IndexNowIntegrationOptionsdirectly are unaffected, making this a NON-BREAKING change.Documentation is added to the existing IndexNow sections.
Verification
Test suite expanded with 4 new cases covering
indexNowOnBranch