Repository navigation
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
Related: #11818 (same createExcerpt regex)
createExcerpt (in @docusaurus/utils) is used to auto-generate a page's meta description / og:description when no description is set in frontmatter. It strips HTML/JSX tags with the regex /<[^>]*>/g, which only matches a tag that opens and closes on the same line.
When the first content node of a doc is a multi-line JSX/MDX element, only its first line is seen (e.g. <MyComponent), the regex finds no >, nothing is stripped, and that literal partial tag becomes the page description.
So a self-closing component written across multiple lines leaks <ComponentName into <meta name="description"> and <meta property="og:description">.
Reproducible demo
Codesandbox didn't display meta tags.
Instead here is the deployment of an old dev commit where we noticed it:
Notice that it says:
<meta name="description" content="<LastCheckedWithVersionsNotice" data-rh="true">
<meta property="og:description" content="<LastCheckedWithVersionsNotice" data-rh="true">Source file of the page is:
wasp-lang/wasp@9e9e739#diff-d8b5abb713973340ba8c74763cc1f66fd480a99a60769fe2be013086e363e853
---
title: Database Studio with Fly.io
comments: true
---
import LastCheckedWithVersionsNotice from "@site/src/components/LastCheckedWithVersionsNotice";
<LastCheckedWithVersionsNotice
versions={{ Wasp: "0.24", "Fly CLI": "0.4.11" }}
/>
This guide shows you how to connect to your production database on Fly.io and run `wasp db studio` to inspect or modify your data.Steps to reproduce
-
Scaffold a fresh site:
npm init docusaurus@latest my-site classic. -
Create a doc with no
descriptionfrontmatter, whose first body content is a multi-line JSX element, then a real paragraph:--- title: Repro --- <SomeComponent foo="bar" /> This paragraph should become the description.
-
npm run start(orbuild) and inspect the page<head>.
Expected behavior
The auto-generated description / og:description should be the first real paragraph:
This paragraph should become the description.
The JSX element should be ignored, the same way a single-line <SomeComponent foo="bar" /> already is.
Actual behavior
description and og:description are set to the first line of the element:
<meta name="description" content="<SomeComponent">
<meta property="og:description" content="<SomeComponent">Your environment
System:
- OS: macOS 26.5
- CPU: (12) arm64 Apple M4 Pro
- Memory: 3.72 GB / 48.00 GB
- Shell: 5.9 - /bin/zsh
Binaries:
- Node: 24.14.1 - /Users/mindek/.nvm/versions/node/v24.14.1/bin/node
- npm: 11.12.1 - /Users/mindek/.nvm/versions/node/v24.14.1/bin/npm
- pnpm: 10.10.0 - /Users/mindek/Library/pnpm/pnpm
- bun: 1.3.14 - /opt/homebrew/bin/bun
Browsers:
- Chrome: 150.0.7871.47
- Firefox Developer Edition: 153.0
- Safari: 26.5
npmPackages:
- @docusaurus/core: ~3.10.1 => 3.10.1
- @docusaurus/faster: ~3.10.1 => 3.10.1
- @docusaurus/module-type-aliases: ~3.10.1 => 3.10.1
- @docusaurus/preset-classic: ~3.10.1 => 3.10.1
- @docusaurus/theme-mermaid: ~3.10.1 => 3.10.1
- @docusaurus/tsconfig: ~3.10.1 => 3.10.1
Self-service
- I'd be willing to fix this bug myself.
Activity
fix(utils): stop createExcerpt leaking multi-line JSX into description (
test(utils): createExcerpt after a multi-line JSX element (meta#12214)
gunjanjaswal commentedon Jul 1, 2026
Opened #12215 for this. It adds an
inHTMLstate tocreateExcerptso an opening<Tagline with no>is skipped until the element closes, instead of leaking into the description. Existing single-line/self-closing tag handling is unchanged, plus a test for the multi-line case.