Vuepress: NotFound.vue missing title and description

Created on 8 May 2018  路  12Comments  路  Source: vuejs/vuepress

  • VuePress 0.8.4
  • Tested on Windows 10 & Ubuntu with same result

There seems to be 2 different ways this issue appears, depending on if you are running dev or a static build.

When in development mode (vuepress dev) the title attribute is blank and the description attribute is missing entirely.

When building the site (vuepress build) the resulting 404.html page has VuePress as the title and the description attribute is blank.

Also worth noteing, head tags listed in the head attribute of property of the config.js file are appearing in the head correctly.

enhancement

Most helpful comment

@hmatalonga I create another PR #376 for this.

All 12 comments

This appears to be the culprit for the issue with vuepress build:
https://github.com/vuejs/vuepress/blob/272df57421d20907b5a1edecabcaad649641e791/lib/build.js#L72-L75

https://github.com/vuejs/vuepress/blob/272df57421d20907b5a1edecabcaad649641e791/lib/build.js#L133-L171

I'm still not certain how to resolve this for vuepress dev though, as it passes the NotFound component as a route just like the other pages, and they render fine. I think it might have been resolved with https://github.com/vuejs/vuepress/pull/277?

I also believe this is related too.

https://github.com/vuejs/vuepress/blob/272df57421d20907b5a1edecabcaad649641e791/lib/build.js#L18

Since the sourceDir is passed to prepare.js the existing pages will make use of inferTitle(frontmatter) to generate the title, I am guessing. So because the 404 default page is added afterwards, that is not applied on that page, therefore the defaults title and description will be used without inferring the proper title...

https://github.com/vuejs/vuepress/blob/272df57421d20907b5a1edecabcaad649641e791/lib/prepare.js#L202-L217

Maybe this will help detecting the issue :stuck_out_tongue:

349

Title and desc is set in Layout.vue now.

@meteorlxy

I just saw the other issues related to this. I hadn't seen your PR #314 yet, will it be merged? that could probably solve all theses cases. Or you are waiting until the Plugin API is published?

@hmatalonga I think #314 could be merged at current stage, as it can solve some problems somehow when the plugin API has not published.

What do you think about that @ulivz

@meteorlxy

I was wondering also if there will be a minor release before the plugin API? Since latest merged PRs introduced new things to the docs...

@hmatalonga

Evan is busy these days and doesn't have time to look at this project. We have no auth to release a new version of npm package now.

@hmatalonga I create another PR #376 for this.

@bayssmekanique

As for the (vuepress dev), it has been fixed by #388

As for the (vuepress build), still need some discussion. An easiest (but a little stupid) way is copying the created() snippet of Layout.vue to NotFound.vue 馃槄

@meteorlxy, I wish I was of more help but I'm still not certain what effect #389 is going to have on this until it's all merged together. From what I see the created() snippet is moving from Layout.vue to ThemeWrapper.vue, so my whole understanding of the flow is muddy.

@bayssmekanique It will solve all the related problem indeed, but there may have some alt solutions.

One possible solution is adding those code here:

https://github.com/vuejs/vuepress/blob/f61bfdd0eea044645953d7b0795ca9542baae0ea/lib/app/app.js#L82-L91

I'll try to implement it later 馃ぃ

fixed at fcaee80358d47a26753eae49979a2047757a1fd8, and It will be released in 0.9.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lesliecdubs picture lesliecdubs  路  3Comments

shaodahong picture shaodahong  路  3Comments

sankincn picture sankincn  路  3Comments

gaomd picture gaomd  路  3Comments

AMontagu picture AMontagu  路  3Comments