Nuxt.js: SEO HTML Head not being set in generated static files

Created on 11 Apr 2020  路  2Comments  路  Source: nuxt/nuxt.js

Version

v2.12.2

Reproduction link

https://github.com/tunecino/nuxt-seo

Steps to reproduce

  • Create a new project
  • Go inside /pages/index.vue
  • Add head() { return { title: "xyz"} } inside page local settings as mentioned in docs.
  • Run yarn generate

What is expected ?

I expected to find <title>xyz</title> inside the generated file (/dist/index.html)

What is actually happening?

Found <title>example</title> instead. Which is my project name.

Additional comments?

The web page works fine in a browser, as far as javascript is enabled as it replaces the title tag correctly at certain point.
But if you disable javascript and reload the page, local settings are omitted and it shows the wrong title.
Even Lighthouse extension, which shows a great SEO score, if reports are expanded, you'll notice it parsed the wrong title.

I thought static pages won't require search engine bots to run any javascript. Is it a bug or did I miss something?

Thanks.

bug-report

Most helpful comment

Because you are using mode: 'spa' (instead of 'universal')

https://github.com/tunecino/nuxt-seo/blob/master/nuxt.config.js#L3

All 2 comments

Because you are using mode: 'spa' (instead of 'universal')

https://github.com/tunecino/nuxt-seo/blob/master/nuxt.config.js#L3

Oh! My bad. That was what I did miss. Thank you @manniL

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pehbehbeh picture pehbehbeh  路  3Comments

surmon-china picture surmon-china  路  3Comments

msudgh picture msudgh  路  3Comments

VincentLoy picture VincentLoy  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments