Skip to content

Gate IndexNow pings behind privacy config#28408

Merged
ErisDS merged 1 commit into
mainfrom
indexnow-privacy-config
Jun 8, 2026
Merged

Gate IndexNow pings behind privacy config#28408
ErisDS merged 1 commit into
mainfrom
indexnow-privacy-config

Conversation

@ErisDS

@ErisDS ErisDS commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

IndexNow notifies search engines when content is published or updated by pinging an external API. Tests and local dev run against real networks, so the ping can fire from non-production environments.

This gates the ping behind Ghost's existing privacy config:

  • config.isPrivacyDisabled('useIndexNow') short-circuits the ping, consistent with update-check, gravatar, and structured data
  • Can be disabled via privacy: {useIndexNow: false} or privacy: {useTinfoil: true}
  • Default behaviour is unchanged — with no privacy config set, the ping still fires in production
  • Also sets privacy__useIndexNow=false in the e2e environment, which boots Ghost with real network access

Tests

  • Added a unit test asserting the ping is skipped when privacy.useIndexNow is disabled
  • Existing IndexNow unit tests pass

@ErisDS ErisDS requested a review from 9larsons as a code owner June 8, 2026 11:22
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 64056eca-fc1b-4e37-967c-15121ebbd975

📥 Commits

Reviewing files that changed from the base of the PR and between df927df and d53df93.

📒 Files selected for processing (3)
  • e2e/helpers/environment/constants.ts
  • ghost/core/core/server/services/indexnow.js
  • ghost/core/test/unit/server/services/indexnow.test.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • ghost/core/test/unit/server/services/indexnow.test.js
  • e2e/helpers/environment/constants.ts
  • ghost/core/core/server/services/indexnow.js

Walkthrough

This PR adds a privacy gate to the IndexNow service: the service imports the shared config module and returns early from ping() when config.isPrivacyDisabled('useIndexNow') is true. Unit tests import and stub config.isPrivacyDisabled and add a test asserting no outbound IndexNow request when the privacy setting disables it. The e2e environment constants are updated to include privacy__useIndexNow=false.

Possibly related PRs

  • TryGhost/Ghost#28311: Adds an early-guard check to IndexNow ping() (URL resolution condition) with corresponding unit test updates, following a similar pattern for conditional request skipping.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: gating IndexNow pings behind privacy configuration.
Description check ✅ Passed The description is directly related to the changeset, explaining the rationale, implementation details, and test coverage for the IndexNow privacy gating feature.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch indexnow-privacy-config

Comment @coderabbitai help to get the list of available commands and usage tips.

IndexNow notifies search engines on publish by pinging an external
API. Tests and local dev run against real networks, so the ping could
fire from non-production environments.

Gate the ping on config.isPrivacyDisabled('useIndexNow'), consistent
with update-check, gravatar, and structured data. It can now be
disabled via privacy.useIndexNow=false or privacy.useTinfoil=true.
Default behaviour is unchanged: with no privacy config the ping still
fires in production.

Also disable it in the e2e environment, which boots Ghost with real
network access.
@ErisDS ErisDS force-pushed the indexnow-privacy-config branch from df927df to d53df93 Compare June 8, 2026 11:46
@ErisDS ErisDS merged commit 4a56300 into main Jun 8, 2026
50 checks passed
@ErisDS ErisDS deleted the indexnow-privacy-config branch June 8, 2026 12:37
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