Replies: 1 comment
-
Hey there! This sounds like a good issue, so I've created an issue from this discussion here #11910
<script>
import { onMount } from 'svelte';
onMount(() => {
// removes the title tag in the app.html template
document.head.querySelector('title')?.remove();
});
</script>
<svelte:head>
<title>Hello world!</title>
</svelte:head> If you want to be really comprehensive, you can query for all title elements and check if there are more than one, then remove the first one in the results array. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello folks 👋
I'm building a SPA with sveltekit and static-adapter, works great, but I have some issues with the SEO tags in the
<head>
of my pages.Here's what I'm doing:
I can do that by using the option
fallback: "index.html"
of adapter-static, and on the +page.ts of the pages I want prerendered:
Which works fine.
Now, let's say that I want a specific
<title>
in the<head>
of my fallback page (which I believe makes sense since this is what the crawlers will see when they try to access any non-prerenderd page). I would need to put the<title>
tag into the app.html file, as it is the file used as a template for the fallback page.On my prerendered pages, I want a different, more specific
<title>
though. So I'm using<svelte:head>
component in their +page.ts file.But since the app.html file is also used as a template for my prerendered pages, I end up with duplicates
<title>
tags in them (the one from app.html and the one from the page's<svelte:head>
component.In summary (app.html) ->
Is there any way to set the
<head>
content of the fallback page other than writing it in app.html?Or is there any way to use another file than app.html as the template for the fallback page ?
Am I doing this wrong ?
Thanks for your support 🙌
Beta Was this translation helpful? Give feedback.
All reactions