I want to add a head title suffix like - mywebsite
on each Svelte page.
I'm struggling finding how to do it with ease and simplicity.
On the svelte website source, we can see they do it manually: https://github.com/sveltejs/svelte/blob/1273f978084aaf4d7c697b2fb456314839c3c90d/site/src/routes/docs/index.svelte#L15
I started creating a component like this:
<script>
export let title = false;
</script>
<svelte:head>
<title>
{#if title}
{title} • WebSite
{:else}
Website • Home suffix
{/if}
</title>
</svelte:head>
But:
- I have a
<title> can only contain text and {tags}svelte(illegal-structure)
error - I'm not sure it's the easiest way.
How can an achieve what I want to do?