Skip to content

Commit 0cfee34

Browse files
Bowl42claude
andauthored
fix: strip HTML tags from config.name when setting page title (#2690)
The `name` config option can contain HTML markup (e.g. `<img>` tags) for rendering a logo in the sidebar. However, this raw HTML was being used directly in `document.title`, causing browser tabs to show markup like `<img src="logo.png">My Site - Page Title`. Strip HTML tags from `name` before using it in the page title so that only the plain text content appears in the browser tab. Fixes #2610 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f4c37e0 commit 0cfee34

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/core/event/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,11 @@ export function Events(Base) {
329329
.find(`.sidebar a[href='${currentPath}']`)
330330
?.getAttribute('title');
331331

332-
const currentTitle = name
332+
const plainName = name ? name.replace(/<[^>]+>/g, '').trim() : name;
333+
const currentTitle = plainName
333334
? currentSection
334-
? `${currentSection} - ${name}`
335-
: name
335+
? `${currentSection} - ${plainName}`
336+
: plainName
336337
: currentSection;
337338

338339
// Update page title

0 commit comments

Comments
 (0)