artiebits / svelte-seo

Optimize your website for search engines and social media with meta tags, Open Graph, and JSON-LD.
https://artiebits.com
MIT License
429 stars 24 forks source link

Tags do not get updated on Sveltekit single page app #61

Closed kevbook closed 1 year ago

kevbook commented 1 year ago

Describe the bug

For a sveltekit single page app (when csr = true), the meta tags are not updated when client-side page navigation happens. In my +layout.svelte file


<script>
  // Load SEO data from the route's load function
  $: title = $page.data.page?.content.seo?.title
</script>

<!-- This works -->
<svelte:head>
  <title>{title}</title>
</svelte:head> -->

<!-- Does not work -->
<SvelteSeo {title} />
kevbook commented 1 year ago

Update: I can do


{#key title}
  <SvelteSeo {title} />
{/key}
lubiah commented 1 year ago

Can you send a reproducible of the bug in a repo