Update post skeleton generator

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya 2019-11-21 11:58:23 +05:30
parent ea0860f2ee
commit 014c0ab2b0
No known key found for this signature in database
GPG Key ID: C2E74282C2133D62
1 changed files with 2 additions and 2 deletions

View File

@ -10,10 +10,10 @@ function create_post() {
else
title="${@}"
fi
postdate="$(date +"%Y-%m-%d")"
postdate="$(date -Is)"
postslug="$(echo "${title}" | tr -dc '[:alnum:][:space:]\n\r' | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')"
filename="${postslug}.md"
printf "+++\ndate = \"%s\"\ntitle = \"%s\"\nslug = \"%s\"\ntags = []\ncategories = []\n+++\n" "${postdate}" "${title}" "${postslug}" > content/posts/"${filename}"
printf "+++\ncategories = []\ndate = %s\ndraft = true\nslug = \"%s\"\ntags = []\ntitle = \"%s\"\n+++\n" "${postdate}" "${postslug}" "${title}" > content/posts/"${filename}"
echo "content/posts/${filename} created!"
}