Jetpack SEO: General Settings tab#49256
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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. |
Code Coverage SummaryThis 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. 🤷 |
1f750c2 to
f405107
Compare
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>
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>
497c55d to
2bdd70c
Compare
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>
c9d4d60 to
a482cb0
Compare
- 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>
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.
Proposed changes
?tab=via@wordpress/route+@wordpress/uiTabs(the Scan pattern), in a.jp-admin-page-tabsstrip. Form state lives in the page root so it survives tab switches.blog_public) and the XML sitemap (the realsitemapsmodule).poststemplate (other structure keys → JETPACK-1685).window.JetpackScriptData.seo.{overview,settings}via thejetpack_admin_js_script_datafilter. Writes reuse the existing/jetpack/v4/settings(title formats, front-page description,sitemapsmodule, verification codes) and core/wp/v2/settingsforblog_public(registeredshow_in_rest)./jetpack/v4/settings's ownJetpack_SEO_Titles::are_valid_title_formats()validation — no bespoke controller.Deliberately out of scope
jetpack_seo_canonical_urls_enabledhad no backing feature in Jetpack. A real feature is JETPACK-1697.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
pnpm install && jetpack build packages/seo plugins/jetpack) on a Jetpack-connected site; sign in as an admin.?tab=settings).blog_public)./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/settingsand core/wp/v2/settingsendpoints.