Repository navigation
vitepress-blog: a blog template with a post list, tag pages, RSS and search #5560
melenaos
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I wanted a blog on VitePress without switching to a separate theme, so I put together a template that adds what a blog needs on top of the default theme:
docs/posts/withcreateContentLoaderdocs/tags/[tag].md+[tag].paths.js)vitepress buildauthors.tsand referenced by key from frontmatterAdd a markdown file to
docs/posts/and the post list, the tag pages, the feed and the search index all pick it up. No other file to touch.Demo: https://bootform.github.io/vitepress-blog/
Repo: https://github.com/BootForm/vitepress-blog (MIT, "Use this template", deploys to GitHub Pages with the included workflow)
Two things I tripped over, in case they save someone time:
createContentLoaderthrows "content loader invoked without an active vitepress process" when it's called from a.paths.jsfile'spaths(). Paths run earlier than a page's data loader, so the tag routes read frontmatter withgray-matterdirectly instead.excerpt: truedoesn't split on<!-- more -->. It falls back to gray-matter's default separator (a second---line) and comes back empty.excerpt: '<!-- more -->'does split, but the excerpt then includes any markup above the marker, so I ended up using adescriptionfrontmatter field for teasers.Feedback welcome, especially on anything that fights VitePress's defaults.
All reactions