fix(seo): fix multi-line YAML description parser, add 2 orphan pages to nav

- generate-docs.py: extract_description_from_frontmatter() now handles
  multi-line YAML block scalars (|, >, indented continuation) — fixes
  14 pages that had 56-65 char truncated descriptions
- mkdocs.yml: add epic-design and research-summarizer to nav (orphan pages)
- Regenerated 251 pages, rebuilt sitemap (278 URLs)
- SEO audit: 0 broken links, 17→3 short descriptions, 278/278 pages
  have "Claude Code Skills" in <title>

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Reza Rezvani
2026-03-18 10:57:08 +01:00
parent 90cef3b3ac
commit 219c1c3dfd
17 changed files with 44 additions and 21 deletions

View File

@@ -105,16 +105,37 @@ def extract_subtitle(filepath):
def extract_description_from_frontmatter(filepath):
"""Extract the description field from YAML frontmatter."""
"""Extract the description field from YAML frontmatter.
Handles single-line, quoted, and multi-line (| or >) YAML descriptions.
"""
try:
with open(filepath, "r", encoding="utf-8") as f:
content = f.read()
match = re.match(r"^---\n(.*?)---\n", content, re.DOTALL)
if match:
fm = match.group(1)
desc_match = re.search(r'description:\s*["\']?(.*?)["\']?\s*$', fm, re.MULTILINE)
if desc_match:
return desc_match.group(1).strip()
if not match:
return None
fm = match.group(1)
# Try quoted single-line: description: "text" or description: 'text'
m = re.search(r'description:\s*"([^"]+)"', fm)
if m:
return m.group(1).strip()
m = re.search(r"description:\s*'([^']+)'", fm)
if m:
return m.group(1).strip()
# Try multi-line block scalar: description: | or description: >
m = re.search(r"description:\s*[|>]-?\s*\n((?:[ \t]+.+\n?)+)", fm)
if m:
lines = m.group(1).strip().splitlines()
text = " ".join(line.strip() for line in lines)
return text
# Try unquoted single-line: description: text
m = re.search(r"description:\s+([^\n\"'][^\n]+)", fm)
if m:
return m.group(1).strip()
except Exception:
pass
return None