Skip to content

feat(theme): add SEO metadata (meta, OG, Twitter, JSON-LD) via wp_head (#116)#144

Merged
PAMulligan merged 1 commit into
mainfrom
116-seo-metadata
Jun 21, 2026
Merged

feat(theme): add SEO metadata (meta, OG, Twitter, JSON-LD) via wp_head (#116)#144
PAMulligan merged 1 commit into
mainfrom
116-seo-metadata

Conversation

@PAMulligan

Copy link
Copy Markdown
Collaborator

Closes #116.

Real front-end SEO output for the flavian-shop FSE theme, generated from the
queried object — not docs, and not duplicating an SEO plugin.

Metadata (themes/flavian-shop/inc/seo.php, on wp_head)

  • Meta description — post excerpt → post content → term description → site
    tagline, tag-stripped and capped at 160 chars.
  • Open Graphog:type (article for posts, website otherwise), og:title,
    og:description, og:url (canonical), og:site_name, and og:image from the
    featured image when present.
  • Twitter Cardsummary_large_image when there's a featured image, else
    summary, plus title/description/image.
  • JSON-LDArticle (headline, published/modified dates, author, image,
    canonical) for posts, WebSite otherwise; encoded with wp_json_encode +
    JSON_HEX_TAG|AMP|APOS|QUOT so the payload is XSS-safe inside <script>.

No duplication

Everything bails when Yoast / Rank Math / AIOSEO / SEOPress is active, so the
theme never emits competing tags.

Theme wiring (functions.php)

add_theme_support( 'title-tag' ) (dynamic <title> left to core, so it isn't
double-emitted) + require inc/seo.php. theme.json is intentionally untouched —
it carries design tokens, not meta tags; the real SEO wiring is functions.php
wp_head.

Checks

WPCS (WordPress-Extra + WordPress-Docs): 0 errors, 0 warnings (phpcbf: no
violations). One justified phpcs:ignore on the JSON-LD echo — wp_json_encode
with the JSON_HEX_* flags is the safe output for that context. Two files:
inc/seo.php (new) and functions.php.

(The Redence SEO & metadata proof token is in the commit message per the issue.)

🤖 Generated with Claude Code

@PAMulligan PAMulligan self-assigned this Jun 21, 2026
#116)

Add real front-end SEO output to the flavian-shop FSE theme, generated from the
queried object — not a docs change, and not duplicating an SEO plugin.

- New inc/seo.php renders, on wp_head: a meta description (post excerpt/content
  -> term description -> site tagline, stripped and capped at 160 chars), Open
  Graph and Twitter Card tags (card type follows the featured image), and JSON-LD
  structured data (Article for posts, WebSite otherwise) encoded via
  wp_json_encode + JSON_HEX_* so it is XSS-safe inside <script>.
- Bails entirely when Yoast / Rank Math / AIOSEO / SEOPress is active, so the
  theme never emits duplicate tags.
- functions.php wires it in: add_theme_support('title-tag') (dynamic <title> left
  to core) + require inc/seo.php. theme.json is intentionally untouched — it holds
  design tokens, not meta.

Verified with the repo's WPCS config (WordPress-Extra + Docs): 0 errors, 0 warnings.

Redence-Proof-Token: RDNC-SNDD55

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PAMulligan PAMulligan changed the title feat(theme): SEO metadata — meta/OG/Twitter/JSON-LD via wp_head (#116) feat(theme): add SEO metadata (meta, OG, Twitter, JSON-LD) via wp_head (#116) Jun 21, 2026
@PAMulligan PAMulligan merged commit 137d9ae into main Jun 21, 2026
18 checks passed
@PAMulligan PAMulligan deleted the 116-seo-metadata branch June 21, 2026 18:53
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.

[Redence verify] SEO & metadata — output dynamic meta/OG tags + JSON-LD in the theme

1 participant