Automating the creation of a new blog post

This entry was posted on
  • tutorial
  • gatsby
  • typescript

MDX and gatsby are great for building a blog. But, its a pain to create all the skeleton stuff every time I want to create a new blog post.

Steps to create a new blog post

  1. Create a new folder under content/posts/{year}/{date-slug}/
  2. Create a new index.mdx file in the above folder.
  3. Copy the frontmatter from a template file or an existing post.
  4. Modify most of the properties for the new post.
  5. If the post has an image gallery, then
    1. create a subfolder images.
    2. copy a data.json file from an existing folder and update it.

Heres an example of the frontmatter for this post