Eleventy-Blog-Template/create

23 lines
318 B
Plaintext

#/bin/bash
TITLE=$@
TITLEF=$(echo $TITLE | tr " " "-")
YEAR=$(date +"%Y")
MONTH=$(date +"%m")
mkdir -p "src/posts/$YEAR/$MONTH"
FILENAME="src/posts/$YEAR/$MONTH/$TITLEF.md"
cat <<EOF > $FILENAME
---
title: "$TITLE"
date: "$(date '+%Y-%m-%d')"
tags:
-
---
<!-- excerpt -->
EOF
echo "Created new post at $FILENAME"