English | 简体中文
A plugin that helps you manage and organize blog posts, based on unplugin. It will index and classify your blog posts according to the front matter information in your blog posts, and provide an easy-to-render and use data object.
Just these, it seems that a plugin is not needed to complete. Indeed, I mainly want to learn how to develop an unplugin plugin, so there is unplugin-blog-manager😊.
npm i unplugin-blog-manager -D
take vite as an example:
// vite.config.ts
import BlogManager from 'unplugin-blog-manager/vite'
export default defineConfig({
plugins: [
Inspect(),
BlogManager({
author: 'jic999',
// please use absolute path, otherwise it may not work
targetDir: resolve(__dirname, './posts'),
excludes: ['index.md'],
}),
],
})
Reference data:
<script setup lang="ts">
import { data as postData } from 'unplugin-blog-manager/data'
console.log(postData)
</script>