-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Describe the bug
npx vitepress init generates a default .vitepress/config.mts based on user responses, which is helpful. One of these questions/responses is the title of the site. This is inserted into config.mts as the title: kv pair for the config object.
However, when title exists without titleTemplate, the html <title> is rendered with duplication.
For example, if the user answers My Site to the title question, the browser displays in the tab or bookmark the title of the site as "My Site | My Site". This is not only unattractive, but it's difficult to discover why this is happening.
Reproduction
https://stackblitz.com/edit/vite-fmv5pr?file=docs%2F.vitepress%2Fconfig.ts
Open the resulting site @ webcontainer.io in a separate browser window to see the result.
Expected behavior
I expect no duplication. This could be accomplished by:
- changing the render code so that if
titleTemplateis missing, thattitleis not rendered as<title>{{ title }} | {{ title }}</title> - Including a
titleTemplatein the init questionnaire; or simply including a default value that is different than what the user answered for title
System Info
System:
OS: macOS 12.6.7
CPU: (10) arm64 Apple M1 Pro
Memory: 80.66 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.13.0 - /usr/local/bin/node
npm: 8.1.0 - /usr/local/bin/npm
Browsers:
Chrome: 120.0.6099.129
Safari: 17.1
### Additional context
_No response_
### Validations
- [X] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).
- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)
- [X] Read the [docs](https://vitepress.dev).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.