Eleventy-Blog-Template/create

23 lines
318 B
Plaintext
Raw Normal View History

2024-01-20 05:59:52 +00:00
#/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"