Cannot set title with useHead
See original GitHub issueEnvironment
- Operating System:
macOS
- Node Version:
v16.15.0
- Nuxt Version:
3.0.0-rc.3
- Package Manager:
pnpm@7.1.7
- Builder:
vite
- User Config:
-
- Runtime Modules:
-
- Build Modules:
-
Describe the bug
head-management#example-usage-with-definepagemeta
Followed the example in the documentation, but the title is still localhost:3000/some-page
.
Additional context
~/layouts/default.vue
<script setup>
const route = useRoute()
useHead({
meta: [{ name: 'og:title', content: `App Name - ${route.meta.title}` }]
})
</script>
<template>
<div>
<div>default</div>
<slot></slot>
</div>
</template>
~/pages/some-page.vue
<script setup>
definePageMeta({
title: 'Some Page'
})
</script>
<template>
<div>some-page</div>
</template>
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
vuejs3, cannot add dynamic title and description with usehead ...
I have been trying to use Vuejs3 useHead package and add dynamic title and decription meta, but i get $route is undefined.... i...
Read more >[Feature Request] Handle titleTemplate like vue-meta #22
Hi, It could be really cool to have a titleTemplate like vue-meta, to be able to set a part of title for each...
Read more >Setting Page Titles in Nuxt 3 - Server Side Up
When migrating an app from Nuxt 2 to Nuxt 3, setting page titles is done slightly different. Here's how to add page titles...
Read more >vuejs3, cannot add dynamic title and description with usehead ...
Coding example for the question vuejs3, cannot add dynamic title and description with usehead meta package-Vue.js.
Read more >useTitle - VueUse
Set initial title immediately: ... Observe `document.title` changes using MutationObserve * Cannot be used together with `titleTemplate` option.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danielroe Here is the reproduction ashgo-x/nuxt-app.
Apologies, that was my mistake. It should be:
https://stackblitz.com/edit/github-wurrmm?file=layouts%2Fdefault.vue,pages%2Fsome-page.vue