blog/scripts/new-post.sh

17 lines
266 B
Bash

#!/bin/bash -e
[[ "$1" = "" ]] && echo No filename given for new post\! && exit 1
file="$(basename $1)"
cat << EOF | tee content/posts/"$file.md"
---
title: $(basename -s .md "$file")
date: $(date '+%F')
draft: false
description:
category: article
image:
---
EOF