Closed oliverpool closed 2 years ago
It's very likely a problem with your code
I took the code of the vue-full
example of this repo. What should I change to make it work?
I couldn't find any hint in the documentation
Updated docs
With vue 3, vite-plugin-md
exposes the frontmatter with defineExpose({ frontmatter })
: https://github.com/antfu/vite-plugin-md/blob/24ae1046f02669dcaf0040483920544b4277a12b/src/markdown.ts#L91
I am looking into your source, how support for defineExpose
could be added, but I currently have no clue, where and how the files are imported into vite-plugin-ssr
.
Could you give a hint, so that I can try to add support of this feature into your repo?
Why not simply using https://vite-plugin-ssr.com/markdown#head-pagecontext-pageexports instead of a frontmatter?
Because it is much more user/editor friendly to edit a frontmatter in mardown than a JS-Block:
export const documentProps = {
title: 'A Markdown Page',
description: 'Example of setting `<title>` and `<meta name="description">`'
}
(for instance the Netlify CMS supports Frontmatter very nicely).
This is probably more of a general vite
question, so I asked on the vite-plugin-md
repo: https://github.com/antfu/vite-plugin-md/issues/38
👍
According to https://vite-plugin-ssr.com/markdown
however I can't get it to work.
I have created a fork with a
md_frontmatter_example
branch to reproduce.https://github.com/oliverpool/vite-plugin-ssr/commit/25d1bfbacacadde7da19ff949322290dbe82ff48
examples/vue-full/pages/markdown-frontmatter.page.md
file with a frontmatter containingtitle: A Markdown Page
Demo
and not the expectedA Markdown Page
The title is however modifeid, when visiting
/markdown
:Is there something missing to make the frontmatter work?