Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Components within svelte:head are appended per page view and not updated #976

Open
@aubergene

Description

@aubergene

Using the sapper-templates as a base I created a new components Meta

<script>
  export let title = "default title";
</script>

<title>{title}</title>

I then import this in to the [slug].svelte page

<script>
  import Meta from "../../components/Meta.svelte";

  export let post;
</script>

and then use it within the svelte:head tag

<svelte:head>
  <meta name={post.title} />
  <Meta title={post.title} />
</svelte:head>

I then browse around the blog pages for a bit and I get output like this, where the <meta> which is a direct child of svelte:head is correctly updated, but the <title> of the Meta component has been appended once for each page visit.

<head>
<title>Why the name?</title>
<title>How to use Sapper</title>
<title>How to use Sapper</title>
<title>How can I get involved?</title>
<meta name="How is Sapper different from Next.js?">
<title>How is Sapper different from Next.js?</title>
</head>

Using sapper 0.27.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions