Skip to content

fix(blog): FAQPage JSON-LD never emitted — extractFaqLd regex requires answer on the line after **Q** but every post writes a blank line #5001

Description

@koala73

Found while implementing #4998. `extractFaqLd` in blog-site/src/layouts/BlogPost.astro extracts `## Frequently Asked Questions` sections into FAQPage JSON-LD with the regex:

```
/**(.+?)**\n([^\n*]+(?:\n[^\n*#]+)*)/g
```

The answer must start on the line IMMEDIATELY after the bolded question. Every post that has an FAQ section (e.g. free-geopolitical-data-apis-2026) writes the standard markdown form with a blank line between question and answer, so the regex matches nothing and `faqLd` is null.

Verified live 2026-07-07: https://www.worldmonitor.app/blog/posts/free-geopolitical-data-apis-2026/ emits BlogPosting + BreadcrumbList JSON-LD only — no FAQPage — despite a 6-question FAQ section.

Fix: allow blank lines after the question (`\n+` instead of `\n`); add a text-extraction guard test that runs the function against the real post corpus and asserts every post with an FAQ section yields at least one Question item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions