One shared template bug silently corrupted Open Graph cards across 836 pages
A developer discovered that Open Graph preview cards on their multilingual site had been cutting words mid-character for roughly a month, affecting 836 pages across 164 tools and 16 languages. The root cause was a single line of code using JavaScript's slice(0, 60), which truncates text by character count without regard for word boundaries. Because OG cards only render when links are shared externally on platforms like Slack or Discord, the bug remained invisible to the author despite all build checks passing cleanly. The issue was compounded by its presence in a shared template function, meaning one flawed line replicated silently across every page at once. The fix required a language-aware clipping function that breaks at word spaces for Latin scripts but falls back to a hard character cut for space-free languages like Japanese, Chinese, and Korean.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in