titleTemplate is not working when titleChunk is undefined
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v19.1.0
- Nuxt Version:
3.0.0
- Nitro Version:
1.0.0
- Package Manager:
npm@8.19.3
- Builder:
vite
- User Config:
modules
,runtimeConfig
,vite
- Runtime Modules:
@nuxtjs/color-mode@3.1.8
- Build Modules:
-
Reproduction
use titleTemplate
without title
Describe the bug
titleTemplate
in useHead
is working with these well.
- nuxt.config.ts -> app.head.title
- script -> useHead.title
- template -> <Title/>

But when I remove title
, page title does not change.
After refresh, ‘localhost:3000/’ is shown rather than default title although titleTemplate
function is called.

I’m not certain this is a bug or not.
If I miss something, How can I print ‘Title’ that located on third position of optional operator in titleTemplate
?
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
vue.js - useHead "titletemplate" not putting title on homepage ...
useHead({ titleTemplate: (titleChunk) => { if(titleChunk) return ... "Movie Site" is not being made the title of the homepage even though ...
Read more >API Reference | Vue Meta
The value of title will be injected into the %s placeholder in titleTemplate before being rendered. The original title will be available on...
Read more >declandewet/vue-meta - Gitter
Hello, I have a problem where my title becomes undefined for my titleTemplate on initial page load or page refresh. While Im navigating...
Read more >Untitled
htmlAttrs: { lang: 'en', amp: undefined // "amp" has no value } ... ```js titleTemplate: (titleChunk) => { // If undefined or blank...
Read more >vue-meta - Awesome JS
Known Issues. Metainfo component has to be present otherwise client side updates wont work; The error Uncaught ReferenceError: body is not defined is...
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 Free
Top 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
I works well. Thank you so much!!
Thanks for reporting this issue.
Have isolated the problem as described, if you don’t manually reset the head with
null
, it won’t update. This is now fixed with @vueuse/head 1.0.17.To upgrade either delete lock file / node_modules and re-install or manually depending on this version.
Let me know if you have any trouble 😃