Last active
August 31, 2022 21:42
-
-
Save gallo-s-chingon/d9b03b8482b899b088b518cf3d08796c to your computer and use it in GitHub Desktop.
Script to prompt user for input to add to filename.md for Jekyll blog post for podcast show notes on website
This file contains 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 | |
# author : @CochinoChingon | |
# about : bash script to create new jekyll posts with minimal-music-project theme by @itsMeaga1n | |
# description : This will make a new Jekyll blog post as an md file and open in neovim to complete for the discography section of the above theme. | |
# URL : https://gist.github.com/gChingon/d9b03b8482b899b088b518cf3d08796c | |
# POSTS -- not necessary but a good habit to be in Git dir; alternatively can use variables to post to Git dir regardless of location | |
read -p "did you copy YouTube link? " answer | |
if [ $answer == y ] | |
then | |
true | |
else | |
echo "copy the YouTube link dumbass!" | |
exit | |
fi | |
if [[ $(pwd) != *_posts ]]; then | |
echo "You must be inside the _posts dir" # test if we are inside the _posts dir | |
exit | |
fi | |
# CAL print 2 month calendar with Days in left column to find Day of week across all printed months | |
ncal -A 2 | |
if [[ $(date -v+2m +%Y) != $(date +%Y) ]]; then # this is to for near end of year months | |
read -p "which year?: " year | |
else | |
year=`date +%Y`; | |
fi | |
read -p "Post date: " pdate # date you want post to go live | |
read -p "Title: " title # episode title | |
read -p "episode category? " category # blog post category | |
read -p "one line for exerpt: " oneline # hopefully this will correctly output everything I write as a full string for the exerpt | |
read -p "image name? (teaser image for blog post) " img | |
read -p "YouTube link: " link # YouTube link for video | |
blogCopy=$(cat $HOME/esc.txt) # blog copy from Descript transcript saved to esc.txt with Keyboard Maestro shortcut | |
postTitle=`echo $title | tr " " "-"` # convert spaces in title to hyphens | |
ytID=`echo $link | cut -d "/" -f4` # cut command uses -d as delimiter (what it breaks sections into) "/" uses the backslash -f4 still cant figure out, would expect count to start at 0 making it f2, but that's for another day | |
ptlower=`echo "$postTitle" | tr '[:upper:]' '[:lower:]'` # convert title to lowercase | |
postname=$year-$pdate-$ptlower.md # file name year-month-day-title.md | |
touch $postname # create blank post | |
# BODY OF POST | |
echo "--- | |
title: $title | |
date: $year-$pdate | |
excerpt: ${oneline[@]} | |
header: | |
teaser: /images/$img | |
overlay_image: /images/show-logo.png | |
overlay_filter: 0.5 | |
category: $category | |
--- | |
{% include video id='$ytID' provider='youtube' %} | |
$blogCopy | |
# Show links | |
<br> Listen on: | |
<br> [Spotify](https://open.spotify.com/show/3XjoipCU3QzeIaQAAQpBdW) <a href='https://open.spotify.com/show/3XjoipCU3QzeIaQAAQpBdW'><i class='fab fa-spotify'></i></a> | |
<br> [Apple Podcasts](https://podcasts.apple.com/us/podcast/sucias-are-my-favorite/id1548173787) <a href='https://podcasts.apple.com/us/podcast/sucias-are-my-favorite/id1548173787 | |
'><i class='fas fa-podcast'></i></a> | |
<br> [Google Podcasts](https://podcasts.google.com/feed/aHR0cHM6Ly9hbmNob3IuZm0vcy80MjI0YzYzYy9wb2RjYXN0L3Jzcw) <a href='https://podcasts.google.com/feed/aHR0cHM6Ly9hbmNob3IuZm0vcy80MjI0YzYzYy | |
<br> Active Socials: | |
<br> [u/SuciasAreMyFavorite](https://reddit.com/u/suciasaremyfavorite/submitted) on Reddit <a href='https://reddit.com/u/suciasaremyfavorite/submitted'><i class='fab fa-square-reddit'></i></a> | |
<br> [@sucias.are.my.favorite](https://instagram.com/sucias.are.my.favorite) on Instagram <a href='https://www.instagram.com/sucias.are.my.favorite'><i class='fab fa-instagram-square'></i></a>" >> $postname | |
/Applications/Emacs.app/Contents/MacOS/Emacs $postname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment