Skip to content

Jetpack SEO: General Settings tab#49256

Merged
dhasilva merged 6 commits into
trunkfrom
add/jetpack-seo-settings-tab
Jun 2, 2026
Merged

Jetpack SEO: General Settings tab#49256
dhasilva merged 6 commits into
trunkfrom
add/jetpack-seo-settings-tab

Conversation

@angelablake
Copy link
Copy Markdown
Contributor

@angelablake angelablake commented May 28, 2026

Part 3 of the 8-PR Jetpack SEO product split (originally by @keoshi; driven here by @angelablake). Stacked on #49203 (PR #2, the foundation) — merge that first.

Adds a Settings tab to the Jetpack SEO admin page.

Note: this was re-implemented on the rebuilt foundation. PR #2 moved the SEO page onto @wordpress/build (wp-build) + the shared script-data layer; this PR was rebuilt to match (the original cut was on the now-removed webpack / react-router / custom-REST-controller architecture).

Proposed changes

  • Tabs. The page is now Overview | Settings, driven by ?tab= via @wordpress/route + @wordpress/ui Tabs (the Scan pattern), in a .jp-admin-page-tabs strip. Form state lives in the page root so it survives tab switches.
  • Settings sections:
    • Site visibility — search-engine indexing (core blog_public) and the XML sitemap (the real sitemaps module).
    • Post title structure — token editor for the posts template (other structure keys → JETPACK-1685).
    • Front-page description.
    • Site verification — Google / Bing / Pinterest / Yandex / Facebook codes.
  • Auto-save (no Save button). Toggles save on change, text/token fields on blur, surfaced via a single "Updating settings… → Settings saved." snackbar (matches the Jetpack → Settings page; per-section Save buttons for the prose sections are a follow-up, JETPACK-1696).
  • Overview tab gains a Site verification card alongside Site visibility. Both cards have a Manage button that deep-links into the matching Settings section, scrolled to the section top (verification also expands).
  • Data layer — no new package endpoints. Initial state is bootstrapped onto window.JetpackScriptData.seo.{overview,settings} via the jetpack_admin_js_script_data filter. Writes reuse the existing /jetpack/v4/settings (title formats, front-page description, sitemaps module, verification codes) and core /wp/v2/settings for blog_public (registered show_in_rest).
  • Title-formats whitelist (must-fix Publicize: Add filter to allow plugins to bypass Publicize #7): handled by /jetpack/v4/settings's own Jetpack_SEO_Titles::are_valid_title_formats() validation — no bespoke controller.

Deliberately out of scope

  • Discoverability (the seo-tools enable/disable toggle, Overview banner, always-visible menu, off-state dimming) → its own follow-up PR. The page only renders when the module is active, so off-state UX is moot here.
  • Canonical URLs card — dropped; the scaffold's jetpack_seo_canonical_urls_enabled had no backing feature in Jetpack. A real feature is JETPACK-1697.
  • Sitemap URL link — removed; Jetpack generates the sitemap on a background cron so the URL 404s until then. Surfacing a reachable link is JETPACK-1694.

Follow-ups filed

JETPACK-1685 (all title structures + per-structure previews), JETPACK-1695 (literal separators between title tokens), JETPACK-1696 (per-section Save buttons), JETPACK-1697 (real Canonical URLs feature), JETPACK-1694 (reachable sitemap link), JETPACK-1686 (Google auto-verify).

Related

Screenshots

Jetpack.SEO.Settings.tab.walkthrough.mp4

Testing instructions

  • Install the PR's Jetpack Beta artifact (or pnpm install && jetpack build packages/seo plugins/jetpack) on a Jetpack-connected site; sign in as an admin.
  • Tabs: open Jetpack → SEO. Switch Overview ↔ Settings (the URL gains ?tab=settings).
  • Auto-save: on Settings, flip a toggle → "Updating settings… → Settings saved" (no button). Edit the front-page description / a verification code and click away (blur) → it saves. Reload → changes persist.
  • Search visibility round-trips to core: toggle "Allow search engines to index this site" off, then check Settings → Reading — "Discourage search engines…" should now be checked (it writes core blog_public).
  • Deep links: from Overview, "Manage" / "Manage verification" jumps to the right Settings section with its title visible; verification lands open.
  • Title whitelist: an invalid title token is rejected by /jetpack/v4/settings (HTTP 400).

Does this pull request change what data or activity we track or use?

No. No new Tracks events or data collection. Reads come from the existing script-data layer; writes go through the existing /jetpack/v4/settings and core /wp/v2/settings endpoints.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the add/jetpack-seo-settings-tab branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/jetpack-seo-settings-tab
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/jetpack-seo-settings-tab

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 28, 2026
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 28, 2026

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@angelablake angelablake closed this Jun 1, 2026
@angelablake angelablake force-pushed the add/jetpack-seo-settings-tab branch from 1f750c2 to f405107 Compare June 1, 2026 23:46
@github-actions github-actions Bot removed the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 1, 2026
angelablake pushed a commit that referenced this pull request Jun 1, 2026
Re-implements PR #49256's Settings tab on the rebuilt (wp-build + script-data)
foundation. The old branch was built on the deleted architecture (webpack,
react-router, a custom REST controller, the useSimple* hooks, CSS modules), so
this ports the portable UI and rebuilds the rest to match the foundation.

- Tabs: the page is now Overview | Settings, driven by `?tab=` via
  @wordpress/route + @wordpress/ui Tabs (Scan's pattern). Form state lives in
  the page root so unsaved edits survive tab switches.
- Settings sections: Site visibility (search-engine indexing + XML sitemap),
  post title structure, front-page description, site verification.
- Reads: bootstrapped onto window.JetpackScriptData.seo.settings via the
  existing script-data filter (no round-trip).
- Writes: @wordpress/api-fetch POST to the existing /jetpack/v4/settings
  endpoint (which already validates/sanitizes every field) — no new package
  REST controller. Save surfaces @wordpress/notices snackbars; a beforeunload
  guard covers unsaved changes on full-page exit.
- Sitemap toggle now drives the real `sitemaps` module, not the placeholder
  `jetpack_seo_sitemap_enabled` option.

Deliberately NOT included (per plan): the seo-tools enable/disable toggle +
Overview banner + always-visible menu + off-state dimming (deferred to a
dedicated discoverability PR), and the Canonical URLs card (placeholder option
with no backing feature in Jetpack — dropped).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@angelablake angelablake reopened this Jun 1, 2026
@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 1, 2026
@angelablake angelablake added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Jun 2, 2026
angelablake pushed a commit that referenced this pull request Jun 2, 2026
Audit pass on the Settings PR's docs and code:
- README: rewrite to present-tense house style (matches Newsletter/Forms),
  covering both the Overview and Settings tabs instead of the foundation-only
  'this ships X; follow-ups add Y' framing.
- get_overview_data() + SiteVisibility type: drop front_page_description — the
  Overview never consumed it and the Settings tab reads it from its own
  settings payload, so it was dead data.
- changelog: note Settings also writes core /wp/v2/settings (blog_public), not
  only /jetpack/v4/settings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the Docs label Jun 2, 2026
@dhasilva dhasilva force-pushed the add/jetpack-seo-foundation branch from 497c55d to 2bdd70c Compare June 2, 2026 18:52
Base automatically changed from add/jetpack-seo-foundation to trunk June 2, 2026 20:22
@github-actions github-actions Bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Jun 2, 2026
Angela Blake and others added 5 commits June 2, 2026 17:37
Re-implements PR #49256's Settings tab on the rebuilt (wp-build + script-data)
foundation. The old branch was built on the deleted architecture (webpack,
react-router, a custom REST controller, the useSimple* hooks, CSS modules), so
this ports the portable UI and rebuilds the rest to match the foundation.

- Tabs: the page is now Overview | Settings, driven by `?tab=` via
  @wordpress/route + @wordpress/ui Tabs (Scan's pattern). Form state lives in
  the page root so unsaved edits survive tab switches.
- Settings sections: Site visibility (search-engine indexing + XML sitemap),
  post title structure, front-page description, site verification.
- Reads: bootstrapped onto window.JetpackScriptData.seo.settings via the
  existing script-data filter (no round-trip).
- Writes: @wordpress/api-fetch POST to the existing /jetpack/v4/settings
  endpoint (which already validates/sanitizes every field) — no new package
  REST controller. Save surfaces @wordpress/notices snackbars; a beforeunload
  guard covers unsaved changes on full-page exit.
- Sitemap toggle now drives the real `sitemaps` module, not the placeholder
  `jetpack_seo_sitemap_enabled` option.

Deliberately NOT included (per plan): the seo-tools enable/disable toggle +
Overview banner + always-visible menu + off-state dimming (deferred to a
dedicated discoverability PR), and the Canonical URLs card (placeholder option
with no backing feature in Jetpack — dropped).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
blog_public is a WordPress core option, not a Jetpack one, so POSTing it to
/jetpack/v4/settings failed with "Invalid option: blog_public" (and the
partial failure left the form out of sync on reload). Route blog_public through
core's /wp/v2/settings instead, registering it with show_in_rest so the core
settings controller round-trips it; the other four fields stay on
/jetpack/v4/settings. Save now fans out to both endpoints and only commits the
baseline when all succeed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…w verification, sitemap links

Addresses four consistency gaps vs other Jetpack admin pages (found in JN review):

- Center page content at 660px (the established JP settings-page width; matches
  Newsletter/Podcast), both tabs.
- Replace the explicit Save button with auto-save: toggles save on change,
  text/token fields on blur, surfaced via a single "Updating settings…" →
  "Settings saved." snackbar (mirrors the Jetpack → Settings page; also how
  Podcast behaves).
- Re-add the Site verification card to the Overview tab; both Overview cards now
  deep-link into the matching Settings section, scrolled to the section top
  (scroll-margin-top clears the sticky header/tabs so the title shows).
- Restore the sitemap link: under the Settings sitemap toggle and on the
  Overview Site-visibility line (404-until-cron-generated caveat tracked in
  JETPACK-1694).
- Overview content now uses a wider centered column (1128px, My Jetpack-like)
  so cards sit side-by-side comfortably; Settings stays the 660px form column.
- Deep-linking to Site verification now also expands that card (was scrolling
  to a collapsed header).
- Overview "Manage" buttons are bottom-right; the Site visibility button reads
  "Manage visibility".
- Drop the sitemap URL links (both /sitemap.xml and the niche Google-News
  /news-sitemap.xml): Jetpack generates the sitemap on a background cron, so the
  URL can 404 until then. Surfacing a link only once the sitemap is actually
  generated is tracked in JETPACK-1694 (via Jetpack_Sitemap_Librarian). The
  sitemap toggle itself is unchanged.
Audit pass on the Settings PR's docs and code:
- README: rewrite to present-tense house style (matches Newsletter/Forms),
  covering both the Overview and Settings tabs instead of the foundation-only
  'this ships X; follow-ups add Y' framing.
- get_overview_data() + SiteVisibility type: drop front_page_description — the
  Overview never consumed it and the Settings tab reads it from its own
  settings payload, so it was dead data.
- changelog: note Settings also writes core /wp/v2/settings (blog_public), not
  only /jetpack/v4/settings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dhasilva dhasilva force-pushed the add/jetpack-seo-settings-tab branch from c9d4d60 to a482cb0 Compare June 2, 2026 21:22
- Use @wordpress/ui Notice (Notice.Root/Description) on the Settings
  "unable to load" state, matching the Overview screen.
- Disable the Settings controls while a save is in flight (wire the
  hook's isSaving), closing the auto-save overlap/baseline-desync window.
- Hoist the verification-services list to data/verification-services.ts
  as the single source consumed by both cards and the save payload.
- Extract the pure payload-diffing and title-token helpers into
  data/build-payload.ts and data/title-format-tokens.ts, and cover them
  with unit tests (19 cases).
- Use double quotes (not backticks) in the Google verification hint.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dhasilva dhasilva merged commit 117b563 into trunk Jun 2, 2026
95 checks passed
@dhasilva dhasilva deleted the add/jetpack-seo-settings-tab branch June 2, 2026 22:09
@github-actions github-actions Bot removed the [Status] Needs Review This PR is ready for review. label Jun 2, 2026
@github-actions github-actions Bot added the [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs [Package] Seo [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publicize: Add filter to allow plugins to bypass Publicize

2 participants