Skip to content

feat(cms): SEO editor with multi-format previews + JSON file viewer#3655

Open
rafavalls wants to merge 6 commits into
mainfrom
rafavalls/seo-json-viewer-in-preview
Open

feat(cms): SEO editor with multi-format previews + JSON file viewer#3655
rafavalls wants to merge 6 commits into
mainfrom
rafavalls/seo-json-viewer-in-preview

Conversation

@rafavalls
Copy link
Copy Markdown
Collaborator

@rafavalls rafavalls commented Jun 2, 2026

What is this contribution about?

Brings the deco.cx SEO and JSON viewer experiences into Studio's CMS. The Content tab gains an SEO section for editing the site default SEO, plus a two-pane page-SEO editor (form on the left, live previews on the right across Google, Facebook, X, LinkedIn, WhatsApp, Telegram, Slack and Discord), where page previews layer the site default behind page overrides to show what actually renders. "View JSON" now opens the page's block file in the code view, and SEO is also reachable from the Preview tab's menu and the sections editor header (with an "Edit default SEO" shortcut). Also includes polish: colorized/typed file-tree icons with a proper folder icon, a credit-card-search SEO icon, and a fix for image/file widget inputs being clipped by an overflow-hidden.

How to Test

  1. Open a project's Content tab → click SEO to edit the site default; edit a field and confirm the previews update and the value persists.
  2. Open a page → Edit SEO: confirm the two-pane editor shows inherited defaults in the previews, the "Edit default SEO" button jumps to the site SEO, and empty fields stay empty in the form.
  3. Use View JSON on a page (Content or Preview) and confirm the block file opens in the code/file view.

Migration Notes

None.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

Summary by cubic

Adds a schema-driven SEO editor with live, multi-platform previews and a “View JSON” viewer. Resolves SEO types from the manifest, unifies the SEO editor across entry points, and hardens autosave and preview/file safety.

  • New Features

    • Content tab: new SEO section for editing the site default.
    • Page SEO editor: two-pane form with live previews (Google, Facebook, X, LinkedIn, WhatsApp, Telegram, Slack, Discord); previews layer site defaults under page overrides.
    • SEO type selection when multiple variants are exposed by the live schema; defaults derived from the manifest (not hardcoded).
    • Entry points: “SEO” in Content; “Edit SEO”, “Site SEO”, and “View JSON” from Preview, pages, and headers.
    • File explorer: deep-link file opening (e.g., /.deco/blocks/<key>.json) and colorized file/folder icons.
  • Bug Fixes

    • Hardened autosave: resolve writes at fire time against the latest block (read-modify-write), cancel on unmount, and flush pending saves on close.
    • Schema correctness: drive the form schema from the active __resolveType and site type options; guard __resolveType and malformed SEO/page entries to avoid crashes.
    • Safer previews and file viewer: restrict preview images to https and validate block file paths; clear code-view deep-links when exiting code mode.
    • Restored focus rings by removing overflow clipping in image/file inputs.

Written for commit 5d56025. Summary will update on new commits.

Review in cubic

Add a Content-tab "SEO" section for editing the site default SEO and a
two-pane page SEO editor (form + live previews across Google, Facebook,
X, LinkedIn, WhatsApp, Telegram, Slack, Discord). Page previews layer
the site default behind page overrides to reflect what actually renders.
Also: "View JSON" opens the page block file in the code view, colorized
file-tree icons, an SEO icon, and a fix for clipped image/file inputs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Release Options

Suggested: Minor (2.387.0) — based on feat: prefix

React with an emoji to override the release type:

Reaction Type Next Version
👍 Prerelease 2.386.2-alpha.1
🎉 Patch 2.386.2
❤️ Minor 2.387.0
🚀 Major 3.0.0

Current version: 2.386.1

Note: If multiple reactions exist, the smallest bump wins. If no reactions, the suggested bump is used (default: patch).

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 11 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/mesh/src/web/components/sections-editor/sections-editor.tsx Outdated
Comment thread apps/mesh/src/web/components/sections-editor/seo-block.ts Outdated
rafavalls and others added 2 commits June 2, 2026 16:57
…tests

Unify the three duplicated debounced-save paths (SeoEditor, the SEO sheet,
inline SEO in SectionsEditor) behind a shared useDebouncedSaveBlock hook and a
single resolveSeoTarget resolver. Export AUTOSAVE_DELAY and
DEFAULT_SEO_RESOLVE_TYPE from one place; merge PageSeoSheet/SiteSeoSheet into a
single SeoSheet({ target }). Reset codeFilePath when leaving code mode so
re-entering opens the file tree, guard PageJsonDialog against a missing key,
and add unit tests for the seo-block heuristics.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…solveType cast

The SEO autosave snapshotted the full page block at keystroke time and
persisted it after a debounce, clobbering concurrent page name/path edits
written to the same block from a separate debounce (and vice-versa). Resolve
both writes at fire time against the freshest decofile (latestRef) so each is a
read-modify-write rather than a stale snapshot; useDebouncedSaveBlock now
accepts a fire-time builder for this. Also guard the unchecked `as string` cast
on __resolveType in findSiteSeoEntry with a typeof check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 8 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread apps/mesh/src/web/components/sections-editor/use-save-block.ts
Comment thread apps/mesh/src/web/components/sections-editor/seo-block.ts Outdated
rafavalls and others added 3 commits June 2, 2026 20:59
…O entries

Address PR review (cubic-dev-ai):
- useDebouncedSaveBlock now clears its pending debounce timer on unmount so a
  save can't fire against a torn-down editor.
- resolveSeoTarget validates that the page block and its `seo` are plain objects
  before spreading them into the saved payload; add an isPlainObject guard and
  reuse it across findSiteSeoEntry/inferSeoResolveType. Covered by new tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Derive page and site SEO resolveTypes from live page/site JSON Schema
unions instead of hardcoding SeoV2, and add an SEO type selector when
the schema exposes multiple variants.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use fire-time decofile merges for SeoEditor/SeoSheet, flush pending saves
on close, drive schema from active __resolveType with site type options,
validate block file paths, restrict preview images to https, and route
Preview CMS SEO through SeoSheet instead of inline editing.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants