add compose guide

This commit is contained in:
Timothy 2021-01-18 21:49:59 +08:00
parent 021eaac193
commit d3f6716917
3 changed files with 29 additions and 1 deletions

View file

@ -82,6 +82,20 @@ You can start editing the page by modifying `pages/index.js`. The page auto-upda
`pages` - pages to route to. Read the [Next.js documentation](https://nextjs.org/docs) for more information
## Compose
`scripts/compose.js` can be used to easily generate a post with pre-filled front matter.
The first argument is the name of the post and the second optional argument is the extension (default to .mdx)
Example code to generate the post called "My First Post" in markdown format
```
node ./scripts/compose.js "My First Post" .md
```
This will generate `./data/blog/my-first-post.md` with pre-filled front matter.
## Deploy
**Vercel**

View file

@ -88,6 +88,20 @@ You can start editing the page by modifying `pages/index.js`. The page auto-upda
`pages` - pages to route to. Read the [Next.js documentation](https://nextjs.org/docs) for more information
## Compose
`scripts/compose.js` can be used to easily generate a post with pre-filled front matter.
The first argument is the name of the post and the second optional argument is the extension (default to .mdx)
Example code to generate the post called "My First Post" in markdown format
```
node ./scripts/compose.js "My First Post" .md
```
This will generate `./data/blog/my-first-post.md` with pre-filled front matter.
## Deploy
**Vercel**

View file

@ -24,6 +24,6 @@ summary:
---
`
fs.writeFile(`data/blog/${date}-${fileName}.${ext}`, frontMatter, (err) => {
fs.writeFile(`data/blog/${fileName}.${ext}`, frontMatter, (err) => {
if (err) throw err
})