Open humbinal opened 3 years ago
The docs show this feature as missing from Vitepress
https://vitepress.vuejs.org/guide/differences-from-vuepress.html#general
+1
It's the only blocker for me to migrate from vuepress.
sorry i didn't understand if permalinks (a must have for me, too) has a working workaround or not. or if it'll every have
Regarding the has-workaround label, you can use rewrites to write some code like this. Feel free to customize it or comment here if you're having any issues. Note that you'll need to restart the server (press r on terminal) each time you create a new file or add date in it's frontmatter to regenerate rewrites.
// .vitepress/config.ts
import { defineConfig } from 'vitepress'
import fg from 'fast-glob'
import matter from 'gray-matter'
const rewrites = {}
const pages = await fg('**/*.md', { ignore: ['node_modules/**'] })
pages.map((page) => {
const { date } = matter.read(page).data as { date: Date }
if (date)
rewrites[page] = `${date.getFullYear()}/${
date.getMonth() + 1
}/${date.getDate()}/${page}`
})
export default defineConfig({
rewrites
})
Did vitpress support permalink in frontmatter? I try to config but not work.