Clamp a title to TITLE_MAX_LENGTH characters in the same
word-boundary-preserving fashion as truncateDescription.
No mid-sentence ellipsis. When the title overruns the budget and
no natural clause boundary exists inside the
[HEADLINE_SOFT_MIN, TITLE_MAX_LENGTH] window, this function returns
an empty string instead of a mid-sentence โฆ truncation. The empty
return tells the caller to fall through to the next tier of the
resolver ladder (template-fallback title with category + date),
producing a complete, scan-friendly title rather than a clipped
editorial fragment. Live-site regression (2026-05): titles such as
AI Trade Strategy: A Legislative First with Structuralโฆ and
The European Parliament's 24 standing committees continuedโฆ
were emitted before this guard.
Parameters
text: string
Raw title text
Returns string
Clause-truncated title (no ellipsis), or '' when no
editorial clause boundary exists in the window
Clamp a title to
TITLE_MAX_LENGTHcharacters in the same word-boundary-preserving fashion as truncateDescription.No mid-sentence ellipsis. When the title overruns the budget and no natural clause boundary exists inside the
[HEADLINE_SOFT_MIN, TITLE_MAX_LENGTH]window, this function returns an empty string instead of a mid-sentenceโฆtruncation. The empty return tells the caller to fall through to the next tier of the resolver ladder (template-fallback title with category + date), producing a complete, scan-friendly title rather than a clipped editorial fragment. Live-site regression (2026-05): titles such asAI Trade Strategy: A Legislative First with StructuralโฆandThe European Parliament's 24 standing committees continuedโฆwere emitted before this guard.