Skip to content

fix(collections): tolerate unquoted colons in titles + cleaner excerpts#22

Merged
ronreiter merged 1 commit into
mainfrom
fix/frontmatter-colons
Apr 24, 2026
Merged

fix(collections): tolerate unquoted colons in titles + cleaner excerpts#22
ronreiter merged 1 commit into
mainfrom
fix/frontmatter-colons

Conversation

@ronreiter
Copy link
Copy Markdown
Owner

Blog list pages were showing raw YAML in the excerpt and filenames as link text because the model's title: Foo: Bar tripped the strict YAML parser. Shared front-matter helper falls back to a naive first-colon split; excerpts now strip headings / images / HTML. Verified locally against site 2980b971.

The model keeps emitting YAML values like \`title: Commute Mastery: Owning the Road\`
— the second colon makes front-matter's strict YAML parse throw.
buildCollections then fell back to an empty data object, which made
\`post.title\` resolve to the filename (\`commute-mastery.md\`), which
slugified to \`commute-mastery-md\`, and the excerpt extraction was
also running against the un-stripped source so the user saw
front-matter \`---\` lines in their blog list.

Three fixes, one file each:

1. src/runtime/frontMatter.ts (new) — shared YAML front-matter
   parser used by both the markdown renderer and buildCollections.
   Three tiers: strict \`fm()\` parse, fenced split + \`fm()\`, and a
   naive \`key: value\` per-line fallback that splits on the first
   colon only so "Commute Mastery: Owning the Road" comes through
   as a complete string. markdownRender re-exports parseFrontMatter
   from here so existing callers are unchanged.

2. src/runtime/nunjucksRender.ts buildCollections — strips leading
   headings, markdown images, and raw HTML tags from the body before
   truncating to 180 chars. Previous excerpts surfaced hero <img>
   tags as the lead text.

3. scripts/ — a local verify harness for the exact site the user
   flagged confirmed all three blog posts now resolve to proper
   titles, dates, and prose excerpts.

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

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spaceforge Ready Ready Preview, Comment Apr 24, 2026 6:18pm

@ronreiter ronreiter merged commit 9714d8c into main Apr 24, 2026
1 of 2 checks passed
@ronreiter ronreiter deleted the fix/frontmatter-colons branch April 24, 2026 18:18
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.

1 participant