EU Parliament Monitor — API Documentation - v0.9.13
    Preparing search index...

    Function buildLegacyBackfillDescription

    • Prefix legacy descriptions with date and localized category label so duplicate strings become page-specific before the 180-character snippet cap. Two-tier strategy:

      1. Substantive resolver output (≥MIN_ARTICLE_DESCRIPTION_LENGTH chars) is returned unchanged — no prefix is prepended. The description is already unique per page because it contains article-specific editorial content (named bills, vote outcomes, coalition dynamics). Adding a bureaucratic prefix in that case only steals SERP characters from real content.
      2. Short / placeholder descriptions get a localized prefix ${date} — ${ARTICLE_TYPE_LABELS[lang][category]} — so the duplicate-deduper still works on legacy articles whose <meta description> is formatSlug(slug)-only or a generic stub. The category noun is translated via ARTICLE_TYPE_LABELS so Arabic / Hebrew / Swedish cards no longer carry the English "EN Committee Reports" wart that the prior single-language formatSlug(slug) form produced.

      Parameters

      • date: string

        Article date (ISO YYYY-MM-DD)

      • slug: string

        Article slug (used to derive the category)

      • lang: string

        Article language (ISO 639-1 lower-case code)

      • description: string

        Candidate description (resolver output preferred)

      Returns string

      Page-specific description, prefix-free when description is already substantive