A cli tool like hexo's hexo new [post name]
npm i --save-dev docusaurus-post-generator
yarn add -D docusaurus-post-generator
...
"scripts": {
...
"postgen":"docusaurus-post-generator"
}
...
yarn postgen new [template] [post_name] --type [type]
args:
post_name
: the post file name you want to add with.template
: the corresponding template file intemplate
folder.type (optional)
: the type of the post content, eitherdoc
orblog
, default set toblog
.
a example of script might like this:
yarn postgen new frontend_template 'A technology of Javascript'
You can also add a post file into subfolder by adding a prefix like:
yarn postgen new frontend_template 'javascript/A technology of Javascript'
and a file will be created at blog/javascript/2022-08-13-A-technology-of-Javascript.md
in your project.
---
slug: your-post-name
title: Your Post Name
authors: mujing
tags: [someTag]
hide_table_of_contents: false
---
Your can learn more about markdown file metadata here.