about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHuy-Ngo <duchuy29092000@gmail.com>2021-01-10 20:41:57 +0700
committerHuy-Ngo <duchuy29092000@gmail.com>2021-01-10 20:41:57 +0700
commit61a584c8b855e0028788e788fa082d6d9b61a798 (patch)
treee7ee80f39f4f13ecad32df052cc20c113de5ff37
parent6e8ebe9c4ba8e7c1f526aaf647247b2870c440d7 (diff)
downloadblog-61a584c8b855e0028788e788fa082d6d9b61a798.tar.gz
Add script for adding new posts
-rwxr-xr-xnewpost.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/newpost.sh b/newpost.sh
new file mode 100755
index 0000000..7918999
--- /dev/null
+++ b/newpost.sh
@@ -0,0 +1,16 @@
+printf "Blog title: "
+read title
+printf "Tags: "
+read tags
+printf "Categories: "
+read categories
+name="_posts/$(date -I)-${title,,}"
+name=${name/ /-}.md
+_date=$(date "+%Y-%m-%d %T %z")
+echo "---" >> $name
+echo "layout: post" >> $name
+echo "title:  \"$title\"" >> $name
+echo "date:   $_date" >> $name
+echo "tags:   $tags" >> $name
+echo "categories: $categories" >>$name
+echo "---" >> $name