Created
May 9, 2019 23:59
-
-
Save espinz/462548d4b5886ce12c41eb422a0dae8b to your computer and use it in GitHub Desktop.
Jekyll posting script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| length=8 | |
| printf -v line '%*s' "$length" | |
| echo "" | |
| printf "%s\n" "New Post" | |
| echo ${line// /-} | |
| NEWPOST(){ | |
| echo -n "Title: " | |
| read title | |
| echo -n "Categories: " | |
| read categor | |
| echo -n "Tags: " | |
| read tags | |
| date=`date +%Y-%m-%d` | |
| post=$date-$title.markdown | |
| folder="/absolutepath/to/my_collections/_posts" | |
| enterPost="$(printf "%s" `echo "$post"`)" | |
| #touch $(printf "%s" `echo "$folder/$post"`) | |
| cd ${folder} | |
| #cat << END > "$folder/$enterPost" | |
| cat << END > $enterPost | |
| --- | |
| layout: post | |
| title: $title | |
| date: $date | |
| categories: [$categor] | |
| tags: [$tags] | |
| --- | |
| END | |
| vim -s ~/Bin/commands $enterPost #vim macro that enters inserts mode | |
| cd ../.. | |
| bundle exec jekyll build && \ | |
| rsync -pvru --delete /absolutepath to jekyll/_site/* /absolute path to/site folder that will upload to github | |
| } | |
| NEWPOST | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment