You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found it a bit tedious to start my posts from scratch every time and couldn't see a feature to start a boilerplate, so I created this script. You can save it in any file you prefer, I call mine draft:
chmod +x draft
./draft "My Next Blog Post"
I use Typora so I added that as a default starter (works on macOS).
The script:
#!/bin/bash# Check if a title is providedif [ -z"$1" ];thenecho"Usage: $0\"Blog Post Title\""exit 1
fi# Variables
TITLE="$1"
SLUG=$(echo "$TITLE"| tr '[:upper:]''[:lower:]'| tr -cd '[:alnum:] \n\r'| tr '''-')
DATE=$(date +%Y-%m-%d)
FILE_NAME="$SLUG.mdx"# Directory where the blog posts are stored
BLOG_DIR="data/blog"# Create the new post file
cat <<EOF > "$BLOG_DIR/$FILE_NAME"---title: '$TITLE'date: '$DATE'tags: []draft: truesummary: 'This is a placeholder summary.'---Write your post content here.EOF# Open the new post file with Typora
open -a Typora "$BLOG_DIR/$FILE_NAME"echo"New blog post created and opened with Typora: $BLOG_DIR/$FILE_NAME"
Didn't feel this was closely enough to the project for a PR, so thought I would share it here instead.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I found it a bit tedious to start my posts from scratch every time and couldn't see a feature to start a boilerplate, so I created this script. You can save it in any file you prefer, I call mine draft:
chmod +x draft ./draft "My Next Blog Post"
I use Typora so I added that as a default starter (works on macOS).
The script:
Didn't feel this was closely enough to the project for a PR, so thought I would share it here instead.
Beta Was this translation helpful? Give feedback.
All reactions