The schema injector
Structured data is one of the few SEO wins that doesn’t require ranking changes. Schema.org JSON-LD is what unlocks rich results in Google — FAQ accordions, HowTo carousels, Article bylines — and rich results steal real estate in the listing and lift click-through by a meaningful margin. Most CMS platforms won’t generate it for you, and the official answer is usually “edit your theme to inject JSON-LD,” which is fiddly and brittle. Storing the schema with each post as frontmatter is cleaner, works for any post type, and is exactly the repetitive per-post job an assistant should do across your whole archive at once.
What you need
- Specter synced to your blog
- An AI assistant you already use
- A theme tweak that reads a
schemafrontmatter field and renders it in<head>
The recipe
- Pull. Run a Specter pull so each post’s title, author, dates, tags, and excerpt are local and readable.
- Run the schema injector. Paste the prompt below. It writes a
schema:block into each post’s frontmatter and leaves the body untouched. - Dry-run. Spot-check five posts — each should now carry valid JSON-LD as a multi-line YAML string — then preview with a Specter dry-run.
- Push, then validate. Push with Specter, then run three posts through Google’s Rich Results Test. If they pass, schema is live; request indexing to accelerate.
The prompt
You are adding schema.org JSON-LD to every post in this folder, stored as a
frontmatter field called `schema`.
For each .md file:
1. Read the body and frontmatter (title, author, dates, feature image, tags, excerpt).
2. Decide the post type:
- HowTo: title starts with "How to" OR body has a numbered list of 3+ steps.
- FAQ: body has 3+ Q/A pairs (headers ending in "?").
- Article: everything else.
3. Generate the matching JSON-LD:
- Article: headline, author, datePublished, dateModified, image, description,
mainEntityOfPage.
- HowTo: name, totalTime if inferable, steps extracted from the numbered list.
- FAQ: FAQPage with mainEntity as Question objects with acceptedAnswer.
4. Write it into frontmatter as `schema`, using YAML block-scalar (|-) so it's
preserved as a multi-line string.
5. Do NOT modify the post body — frontmatter only.
6. Skip posts under 300 words and log them with a reason.
Finish with a summary: count of Article / HowTo / FAQ added, and count skipped.
Cost and time
| Blog size | Tokens | Cost | Wall-clock |
|---|---|---|---|
| 50 posts | ~150k | $0.30 | 10 min |
| 200 posts | ~600k | $1.40 | 35 min |
| 600 posts | ~1.8M | $4 | 90 min |
Pitfalls
- Eager HowTo extraction. Assistants love to invent step-by-step schema for posts that aren’t tutorials. Keep the “3+ numbered steps” guardrail strict.
- Author and publisher objects. Article schema needs both. If your posts lack author frontmatter, set a global default in the prompt.
- Don’t ship invalid JSON. Run the Rich Results Test on five random posts before pushing the rest — it catches malformed step arrays.
Where to go next
Because it touches only frontmatter, this runs cleanly back to back with the excerpt and alt-text sweep — batch both into a single dry-run review.