Scaffold out a new Gatsby post
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
__snapshots__
.editorconfig
.gitattributes
.gitignore
.prettierignore
.travis.yml
appveyor.yml
index.js
license
package.json
readme.md
test.js

readme.md

new-gatsby-post

Scaffold out a new Gatsby post

Package Version Downloads Status Build Status: Linux Build status: Windows Coverage Status

Why

  • Generates folder structure and frontmatter
  • Async/await ready
  • Simple API
  • 100% test coverage
  • Doesnʼt bundle a CLI. See new-gatsby-post-cli for the command-line tool

Installation

npm install --save new-gatsby-post

Usage

$ pwd
/Users/luftywiranda/blog
const newGatsbyPost = require('new-gatsby-post');

newGatsbyPost('At Least I Tried', { date: '2013-08-05' }).then(path => {
  console.log(path);
  //=> '/Users/luftywiranda/blog/src/pages/blog/2013-08-05-at-least-i-tried'
});
$ tree
.
└── src
    └── pages
        └── blog
            └── 2013-08-05-at-least-i-tried
                └── index.md

API

newGatsbyPost(title, [options])

Returns a promise for the path to the created blog post's directory

title

Type: string

options

Type: Object

location

Type: string
Default: ./src/pages/blog

date

Type: string | number | Date
Default: Date.now()

Date in yyyy-mm-dd format

Related

License

MIT © Lufty Wiranda