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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user