https://github.com/luftywiranda13/new-gatsby-post
Scaffold out a new Gatsby post
https://github.com/luftywiranda13/new-gatsby-post
blog gatsby gatsbyjs react reactjs
Last synced: 16 days ago
JSON representation
Scaffold out a new Gatsby post
- Host: GitHub
- URL: https://github.com/luftywiranda13/new-gatsby-post
- Owner: luftywiranda13
- License: mit
- Created: 2017-12-27T07:56:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-01T16:16:21.000Z (over 6 years ago)
- Last Synced: 2025-04-13T09:06:40.182Z (3 months ago)
- Topics: blog, gatsby, gatsbyjs, react, reactjs
- Language: JavaScript
- Size: 31.3 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# new-gatsby-post
> Scaffold out a new [Gatsby](https://www.gatsbyjs.org/) post
[](https://www.npmjs.com/package/new-gatsby-post)
[](https://npm-stat.com/charts.html?package=new-gatsby-post&from=2016-04-01)
[](https://travis-ci.org/luftywiranda13/new-gatsby-post)
[](https://ci.appveyor.com/project/luftywiranda13/new-gatsby-post/branch/master)
[](https://codecov.io/gh/luftywiranda13/new-gatsby-post)## Why
* Generates folder structure and `frontmatter`
* `Async/await` ready
* Simple API
* 100% test coverage
* Doesnʼt bundle a CLI. _See [new-gatsby-post-cli](https://github.com/luftywiranda13/new-gatsby-post-cli) for the command-line tool_## Installation
```sh
npm install --save new-gatsby-post
```## Usage
```sh
$ pwd
/Users/luftywiranda/blog
``````js
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'
});
``````sh
$ 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
* [new-gatsby-post-cli](https://github.com/luftywiranda13/new-gatsby-post-cli) – CLI for this module
## License
MIT © [Lufty Wiranda](https://www.luftywiranda.com)