withastro/compiler

Closing HTML tag getting removed when there's a component above

diamond-fish opened this issue · 1 comments

Astro Info

Astro                    v4.3.1
Node                     v18.19.0
System                   Windows (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             @astrojs/sitemap

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

No response

Describe the Bug

Steps to reproduce:

  1. Clone https://github.com/robertguss/Astro-Theme-Creek
  2. Update Astro to v4.3.1
  3. Start dev server (npm run dev)
  4. Observe the issue: the </title> tag is missing

From what I can see, if you remove <GoogleAnalytics /> inside BaseHead.astro, then it fixes the issue, which suggests this issue only crops up when a component is added. This issue still exists even if GoogleAnalytics.astro is empty.

What's the expected result?

The </title> tag should be present. Because it's missing, it's causing some side effects, such as the Google Fonts not loading. The H1 font should look like this:

https://astro-theme-creek.netlify.app/

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-2bvud4-crhr4g

Participation

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

Thanks for reporting this! This looks like a regression in the compiler, I'll investigate this further early next week.
In the meantime, you could wrap the title element in an expression as a workaround.

{<title>{title}</title>}

Sorry for the trouble!