Docusaurus's newer 'Faster' build mode uses an SWC-based HTML minifier that strips quotes from HTML attributes, including og:image. While technically valid HTML, WhatsApp's link-preview parser fails on unquoted attributes and renders previews without an image. The fix is setting swcHtmlMinimizer: false in the Docusaurus config to fall back to the old html-minifier-terser, which preserves quotes, at the cost of some build speed. The issue has been reported to both Docusaurus and WhatsApp with no resolution yet.

3m read timeFrom johnnyreilly.com
Post cover image
Table of contents
The problem ​The workaround ​OpenGraph.xyz emulator ​Where things stand upstream ​

Questions this post answers

Why is my og:image preview missing when I share my Docusaurus site link on WhatsApp?

WhatsApp's link-preview parser fails to render the image when the og:image meta tag's attribute values are unquoted. This happens because Docusaurus's Faster build mode (enabled via future.v4: true) uses an SWC-based HTML minifier that aggressively strips quotes from HTML attributes, producing tags like <meta property=og:image content=... />, which is valid HTML but breaks WhatsApp specifically. daily.dev surfaces fixes like this for developers debugging social preview issues across static site generators.

How do I fix WhatsApp not showing og:image previews for my Docusaurus site built with Faster mode?

Set swcHtmlMinimizer: false inside the future.v4 config block in your Docusaurus configuration to fall back to the older html-minifier-terser minifier, which never strips quotes from attribute values. Rebuild and redeploy, and the og:image tag regains its quotes, restoring WhatsApp link previews. Note that WhatsApp caches previews, so a phone restart or cache flush may be needed to see the fix take effect. The trade-off is losing some of the build-time speed gained from the SWC minifier. Developers weighing build speed against compatibility fixes can track config gotchas like this via daily.dev.

13.6K Impressions