Nuxt.js: titleTemplate is not working properly and repeats itself multiple times

Created on 12 Sep 2019  路  3Comments  路  Source: nuxt/nuxt.js

Version

v2.9.2

Reproduction link

https://gitlab.com/matobeno1/nuxt-title-issue/

Steps to reproduce

  • start the dev server
  • open any link in the new tab and watch the site title
  • go to the opened tab and try reloading (alternatively hard reloading)

What is expected ?

The site title for each route should be the way it is defined in the nuxt.config.js

head: {
    titleTemplate: '%s - MyApp',
    title: 'TheTitle',
    // ...
}

So the site title should be e.g. TheTitle - MyApp

What is actually happening?

After several reloads the "- MyApp" is appended so the final look
of the site title is e.g.

TheTitle - MyApp - MyApp

or even

TheTitle - MyApp - MyApp - MyApp - MyApp - MyApp - MyApp (multiple times repeated based on how many times I reload)

Additional comments?

I don't really know how exactly to reproduce this, there is a GIF image in the Reproduction link repo, sometimes you might
need to reload several times, try opening several routes and reloading / hard reloading the site, clicking on route-links and reloading. After a while you should see that the site title is repeating itself. It happens in the production build and development build as well.
Tried to reproduce on Firefox Dev, Edge, Chrome, happens on all of those.
Any help appreciated

This bug report is available on Nuxt community (#c9768)
bug-confirmed

Most helpful comment

Fix willl be available in next release (and also latest nuxt-edge)

All 3 comments

Have transferred this to the vue-meta repo as this seems mostly a vue-meta issue.

This is probably caused by a combination of:
https://github.com/nuxt/vue-meta/pull/429 and
https://vue-meta.nuxtjs.org/api/#generate-since-v2-2 which is used by Nuxt.js in SPA mode

Will have to look into this further

Transferred the issue back to nuxt.js, cause I realized its a Nuxt issue.

Fix willl be available in next release (and also latest nuxt-edge)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattdharmon picture mattdharmon  路  3Comments

mikekidder picture mikekidder  路  3Comments

VincentLoy picture VincentLoy  路  3Comments

vadimsg picture vadimsg  路  3Comments

o-alexandrov picture o-alexandrov  路  3Comments