Skip to content

<title> tag is not generated correctly (especially in a custom theme) #450

@johndigital

Description

@johndigital

When using a custom theme and running the build command, the generated files don't have the correct <title> and <meta> description tags. This seems to also be an issue using the default theme as well, but it's worse with any custom theme.

Here is a repo to help replicate: https://github.com/johndigital/vuepress-title-issue

The master branch shows the primary issue with a minimal configuration, alternately here are the steps to replicate:

  1. npm install vuepress -g
  2. echo '# Hello VuePress' > README.md
  3. create .vuepress/config.js and paste the following config into it:
module.exports = {
    title: 'Title from config.js',
    description: 'Description from config.js'
}
  1. vuepress build

In the generated files, the title of 404.html is "VuePress" but I would expect it to be the default "Title from config.js". In this scenario since we are using the default theme the title of index.html is correct.

  1. create .vuepress/theme/Layout.vue and paste the following minimal layout from the guide:
<template>
  <div class="theme-container">
    <Content/>
  </div>
</template>
  1. vuepress build

The title of both index.html and 404.html in the /dist folder are now set to just "VuePress" rather than the title from the README file or the title from the configuration. The description is also set to an empty string rather than using the description from config.js

This appears to be an issue both when using a global or local installation of vuepress. As demonstrated in the replication repo, the frontmatter titles are ignored as well.

Please let me know if there is other information I can provide to help get this fixed. Per the bug reporting guides, here is all the relevant information about my system:

  • Your OS: OSX 10.13.4
  • Node.js version: 8.11.1
  • VuePress version: 0.8.4
  • Browser version: N/A
  • Is this a global or local install: Either
  • Which package manager did you use for the install: NPM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions