Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicate title tags being rendered - title not updating when navigating pages #2049

Closed
ralyodio opened this issue Jul 31, 2021 · 3 comments
Closed

Comments

@ralyodio
Copy link

Describe the bug

My titles are not updating when I navigate the site.

Reproduction

I have a component for meta tags:

<script>
	export let title = 'chovy\'s boondocking guide';
	export let path = '/';
</script>

<title>{title} - chovy's boondocking guide</title>

I use it like this on a page:

<script>
	import Meta from '$components/meta.svelte';
	const title = 'Mobile Internet Access for Boondocking';
	const path = '/guides/mofi';
</script>

<svelte:head>
	<Meta {title} {path} />
</svelte:head>

If I refresh the page the title is correct, but navigation via links without refresh does not update the title.

Logs

nothing relevant here

System Info

System:
    OS: Linux 5.11 Manjaro Linux
    CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
    Memory: 1.55 GB / 15.39 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.3.0 - ~/.nvm/versions/node/v16.3.0/bin/node
    Yarn: 1.22.11 - /usr/bin/yarn
    npm: 7.15.1 - ~/.nvm/versions/node/v16.3.0/bin/npm
  Browsers:
    Chromium: 92.0.4515.107
    Firefox: 90.0.2
  npmPackages:
    @sveltejs/adapter-static: ^1.0.0-next.13 => 1.0.0-next.13 
    @sveltejs/kit: next => 1.0.0-next.139 
    svelte: ^3.34.0 => 3.41.0 


### Severity

annoyance

### Additional Information

_No response_
@chovyprognos
Copy link

bump

@benmccann
Copy link
Member

This is unrelated to adapter-static and prerendering. You need to put the component that renders the title in the layout

Duplicate of #1540

@benmccann benmccann changed the title trouble with <svelte:head> and adapter-static duplicate title tags being rendered - title not updating when navigating pages Aug 4, 2021
@ralyodio
Copy link
Author

ralyodio commented Aug 5, 2021

my component handles the data. which gets passed the values from each page. Putting it in the layout would make it the same on every page. Obviously I want to customize title and meta tags per page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants