question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

titleTemplate is not working when titleChunk is undefined

See original GitHub issue

Environment

  • 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/>
스크린샷 2022-11-20 오후 4 15 44

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.

스크린샷 2022-11-20 오후 4 15 59

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:closed
  • Created 10 months ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
morugetsmcommented, Nov 21, 2022

I works well. Thank you so much!!

스크린샷 2022-11-21 오후 5 54 08
0reactions
harlan-zwcommented, Nov 21, 2022

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 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found