You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you create a new svelte component, with some tags (title, meta, etc.) then use this component in svelte:head (in a layout.svelte), the tags inside the component get duplicated in the head section after hydration.
What I've tested:
Disable csr / ssr : it works fine, my tags didn't get duplicated
Extracting the tags from the component, and inserting them directly into layout.svelte : it works fine
Testing from firefox / chromium
I've found a weird workaround:
Surround with the svelte:head tag your tags inside the components, then you can put your component either inside or outside the svelte:head tag in the layout.svelte
Reproduction
routes>layout.ts
<script>
import Title from '$lib/Title.svelte';
</script><svelte:head><Title></Title></svelte:head>
<slot/>
lib>Title.svelte
<title>Welcome</title>
-> Add a route>+page.svelte file to create a working route
-> npm run dev -- --open (same result with npm run build && npm run preview)
-> Open the webpage, check source => The tags got duplicated
Describe the bug
When you create a new svelte component, with some tags (title, meta, etc.) then use this component in
svelte:head
(in alayout.svelte
), the tags inside the component get duplicated in the head section after hydration.What I've tested:
layout.svelte
: it works fineI've found a weird workaround:
Surround with the
svelte:head
tag your tags inside the components, then you can put your component either inside or outside thesvelte:head
tag in thelayout.svelte
Reproduction
routes>layout.ts
lib>Title.svelte
-> Add a
route>+page.svelte
file to create a working route->
npm run dev -- --open
(same result withnpm run build && npm run preview
)-> Open the webpage, check source => The tags got duplicated
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: