Node.js script for generating a new markdown post for a Gatsby blog

I have a blog script I use whenever I have an idea:

Running blog "My New Blog Post" does the following:

  • Creates a markdown file named my-new-blog-post.md in your content directory

  • Fills out the frontmatter: title, slug, date, published

  • Launches your Gatsby server (if not already running)

  • Opens your browser directly to your new post

  • Opens VS Code to your new markdown file

This saves me a ton of time when creating a new post.

Have you created any time-saving utils you can share with me? :smiley:

Here’s my script. It just lives in my Gatsby app and lets me `yarn newPost “This is the title of my cool new post” and drops a front matter filled mdx file in the right location: