Merge a localized article.<lang>.md with the canonical English article.md. Returns a single Markdown string ready to be handed to renderArticleHtml.
Behaviour contract:
When lang === 'en' the English source is returned unchanged (defensive โ render-articles.ts already takes the English path directly, but this keeps the function safe to call from any caller).
When the localized file has no body content, the English body is used directly with the localized front-matter (so at minimum the title/description are translated even if the agent failed).
When both have content, the merged body is localizedBody + boundary + englishBody, where boundary is the localized "Detailed analysis (in English)" H2 + aside note.
The merged front-matter:
Starts from the English front-matter (so canonical fields remain intact).
Overlays every field present in the localized front-matter except the keys in ENGLISH_ONLY_FRONT_MATTER_KEYS (date, slug, layout, etc.) and description. This keeps localized metadata while preventing canonical drift and ensuring descriptions only come from executive briefs.
Forces language: <lang> so JSON-LD inLanguage and SEO match.
Merge a localized
article.<lang>.mdwith the canonical Englisharticle.md. Returns a single Markdown string ready to be handed torenderArticleHtml.Behaviour contract:
lang === 'en'the English source is returned unchanged (defensive โ render-articles.ts already takes the English path directly, but this keeps the function safe to call from any caller).localizedBody + boundary + englishBody, whereboundaryis the localized "Detailed analysis (in English)" H2 + aside note.The merged front-matter:
ENGLISH_ONLY_FRONT_MATTER_KEYS(date, slug, layout, etc.) anddescription. This keeps localized metadata while preventing canonical drift and ensuring descriptions only come from executive briefs.language: <lang>so JSON-LDinLanguageand SEO match.