homepage/content/blog/new
Neale Pickett 8da6378b3a
All checks were successful
Homepage / publish (push) Successful in 17s
fix build?
2024-08-14 21:24:18 -06:00

39 lines
570 B
Bash
Executable file

#! /bin/sh
cd $(dirname $0)
case "$1" in
""|-*)
cat <<EOD 1>&2; exit 1
Usage: $0 SLUG [TITLE]
Makes a new blog page with the slug SLUG.
Also uses SLUG for the page title,
unless you provide TITLE.
You can, of course, change this later.
EOD
esac
SLUG="$1"
TITLE="${2:-$SLUG}"
YYYY="$(date +%Y)"
MM="$(date +%m)"
DD="$(date +%d)"
slug=$(echo "$SLUG" | tr 'A-Z ' 'a-z-' | tr -d ':')
dir="$YYYY/$MM-$DD-$slug"
index="$dir/index.md"
mkdir -p "$dir"
cat <<EOD >"$index"
---
title: "$TITLE"
date: $YYYY-$MM-$DD
tags:
- untagged
---
EOD
echo $index
vim + $index