Skip to content

Instantly share code, notes, and snippets.

@jsjoeio
Last active May 9, 2020 22:34
Show Gist options
  • Save jsjoeio/ccc1cc5bf7f12df329da3eafa00c79d2 to your computer and use it in GitHub Desktop.
Save jsjoeio/ccc1cc5bf7f12df329da3eafa00c79d2 to your computer and use it in GitHub Desktop.
Gatsby Recipe: Generate a Blog Post Faster with Hygen

Generate a Blog Post Faster with Hygen

Hygen is a code generator that saves you time.

You can save yourself time by using it to generate a blog post template so you can start writing faster.


Install hygen, day.js, and open npm packages

Day.js is a date library which will be used for the blog post directory name.

open will open the new blog post up in your browser


Great! Now we need to create our blog post template file.

We're also going to create a prompt.js file, which will allow us to answer a few questions when creating the blog post.


Last thing we need to do is add a script to the package.json:


That's it! Now test it out!

Using npm:

npm run g:post

Using yarn:

yarn g:post

To read more about Hygen's handy helpers and inflections, check out the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment