blog/scripts/new-post.sh

18 lines
334 B
Bash
Raw Normal View History

2023-01-16 23:42:42 +00:00
#!/bin/bash -e
2021-12-31 07:37:45 +00:00
[[ "$1" = "" ]] && echo No filename given for new post\! && exit 1
name="$(basename -s .md $1)"
2021-12-31 07:37:45 +00:00
echo Creating new post content/posts/$name.md with metadata:
cat << EOF | tee content/posts/"$name.md"
2021-12-31 07:37:45 +00:00
---
2022-08-08 19:00:04 +00:00
title: $(basename -s .md "$file")
2021-12-31 07:37:45 +00:00
date: $(date '+%F')
draft: false
description:
category: article
image:
---
EOF