Skip to content

Plain text and any content after the text in <title>{expr}text...</title> leak into <body> if no space follows the JS expression #1109

@TitaniumX9000

Description

@TitaniumX9000

Astro Info

Astro                    v5.13.5
Node                     v22.18.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Plain text and any content after that (JS expression included) in <title>{script}text...</title> inside <head></head> leaks into <body></body> if there was no space between {expr} and text.

For instance, with <title>{name}'s blog {expr}</title>, the 's blog [expr content] turns out at the beginning of <body></body> instead of <head></head>. However, astro works correctly with <title>{name} blog</title>, <title>{name}{title}</title> or <title>my{name}</title>.

What's the expected result?

All the contents written in <title></title> should show up in tab titles instead of ending up in the body part and being rendered as page contents, regardless of whether a space was placed between JS expression and plain text or not.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-pywaozvi?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions