Frontmatter config not behaving as expected
See original GitHub issueDescribe the bug
There seems to be an error with using multiline configs in the Frontmatter. The error is best seen in attempting to recreate the Hero and Features sections from the Frontmatter Configs docs.
Hero
When attempting to recreate the hero section from the docs, I get the following error:
[vite] Internal server error: duplicated mapping key at line 10, column 4:
text: Get Started
^
👉 Removing the actions such that the Frontmatter only contains the code below, does not result in an error of any kind but does not render anything on the page.
---
layout: home
hero:
name: VuePress
text: Vite & Vue powered static site generator.
tagline: Lorem ipsum...
---
Features
Similarly, in attempting to recreate the features section I get the error:
[vite] Internal server error: end of the stream or a document separator is expected at line 8, column 2:
- icon: 🖖
^
👉 Removing all but one feature, as shown in the code below, does not give errors but results in only icon being displayed.
---
layout: home
features:
- icon: ⚡️
title: Vite, The DX that can't be beat
details: Lorem ipsum...
---

👉 Removing the icon field results in the following:
---
layout: home
features:
- title: Vite, The DX that can't be beat
details: Lorem ipsum...
---

Reproduction
File containing the exact code as per the hero section of the docs:
---
layout: home
hero:
name: VuePress
text: Vite & Vue powered static site generator.
tagline: Lorem ipsum...
actions:
- theme: brand
text: Get Started
link: /guide/what-is-vitepress
- theme: alt
text: View on GitHub
link: https://github.com/vuejs/vitepress
---
Expected behavior
Reproduce the hero section as per the docs
System Info
System:
OS: macOS 12.1
CPU: (8) arm64 Apple M1
Memory: 98.45 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.17.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.15.0 - /usr/local/bin/npm
Browsers:
Chrome: 104.0.5112.101
Safari: 15.2
npmPackages:
vitepress: ^1.0.0-alpha.13 => 1.0.0-alpha.13
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Thanks for the assistance, it did turn out to be an indentation issue that was caused by auto-formatting settings in the IDE.