Skip to content

Instantly share code, notes, and snippets.

@Qooh0
Created January 26, 2020 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Qooh0/4106bf4205b0a5cdc27643bc07c8dc44 to your computer and use it in GitHub Desktop.
Save Qooh0/4106bf4205b0a5cdc27643bc07c8dc44 to your computer and use it in GitHub Desktop.
Create blog post template for Gatsby.js
#!/usr/bin/env sh
set -eu
## How to use
# ./create_post.sh *title*
## Output
# content/posts/2020-01-26--*title*/
# ./index.md
DATETIME=`date +%Y-%m-%d--`
TARGET_DIR=content/posts/$DATETIME$1
mkdir $TARGET_DIR
cat <<EOF > $TARGET_DIR/index.md
---
title: $1
category: "announcement"
cover: //*TODO*
author: *me*
---
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment