vitepress: Render ignored frontmatter of layout in root page

Describe the bug

After launched the dev it thrown this exception: 20:50:08 [vitepress] Internal server error: end of the stream or a document separator is expected at line 3, column 7: layout: home ^ Plugin: vitepress File: /Users/feiron/Movies/CSKB_Hosting-master/docs/index.md at generateError (file:///Users/feiron/Movies/CSKB_Hosting-master/node_modules/.store/vitepress@1.2.3/node_modules/vitepress/dist/node/serve-CEEKiiuH.js:22356:10) at throwError (file:///Users/feiron/Movies/CSKB_Hosting-master/node_modules/.store/vitepress@1.2.3/node_modules/vitepress/dist/node/serve-CEEKiiuH.js:22362:9) at readDocument (file:///Users/feiron/Movies/CSKB_Hosting-master/node_modules/.store/vitepress@1.2.3/node_modules/vitepress/dist/node/serve-CEEKiiuH.js:23734:5) at loadDocuments (file:///Users/feiron/Movies/CSKB_Hosting-master/node_modules/.store/vitepress@1.2.3/node_modules/vitepress/dist/node/serve-CEEKiiuH.js:23777:5) at load$1 (file:///Users/feiron/Movies/CSKB_Hosting-master/node_modules/.store/vitepress@1.2.3/node_modules/vitepress/dist/node/serve-CEEKiiuH.js:23803:19) at Object.safeLoad (file:///Users/feiron/Movies/CSKB_Hosting-master/node_modules/.store/vitepress@1.2.3/node_modules/vitepress/dist/node/serve-CEEKiiuH.js:23826:10) at parse$5 (file:///Users/feiron/Movies/CSKB_Hosting-master/node_modules/.store/vitepress@1.2.3/node_modules/vitepress/dist/node/serve-CEEKiiuH.js:25053:17) at parseMatter (file:///Users/feiron/Movies/CSKB_Hosting-master/node_modules/.store/vitepress@1.2.3/node_modules/vitepress/dist/node/serve-CEEKiiuH.js:25162:17) at matter (file:///Users/feiron/Movies/CSKB_Hosting-master/node_modules/.store/vitepress@1.2.3/node_modules/vitepress/dist/node/serve-CEEKiiuH.js:25103:10) at md.render (file:///Users/feiron/Movies/CSKB_Hosting-master/node_modules/.store/vitepress@1.2.3/node_modules/vitepress/dist/node/serve-CEEKiiuH.js:25288:45)

meanwhile, the page rendered as 404; after a refresh, it displayed the root markdown and ignored the frontmatter.

here’s screenshots for comparison: image

and here’s what it should be: image

other screenshots: image image

Reproduction

here’s the online repro: https://stackblitz.com/edit/vite-kcrtdk

  • <del>Set up i18n</del> this step is not necessary
  • Set up a series of frontmatter which implements default theme layout in default language path
  • add “features” part after the layout setups
  • write some markdown and some HTML after the end of frontmatter
  • run in dev

Expected behavior

the rendered page should display as what set-up by layout preset.

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 50.77 MB / 16.00 GB
    Shell: 3.2.57 - /bin/sh
  Binaries:
    Node: 20.9.0 - /usr/local/bin/node
    npm: 10.1.0 - /usr/local/bin/npm
  Browsers:
    Safari: 17.5
  npmPackages:
    vitepress: ^1.0.0-alpha.45 => 1.2.3

Additional context

I’ve checked for duplicate but I don’t know if there’s any expression that represents to my same meaning.

Validations

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (11 by maintainers)

Most upvoted comments

I’ve checked that already, never did I do that.

Is this the file which you’re referencing - https://github.com/fr1g/docs/blob/c1b9ed428dc665777eea81d9c7ee1653d7c8b5b8/index.md?plain=1 ? It clearly has extra ---