Work I did over the weekend, new blog post

This commit is contained in:
techrunner
2025-11-04 10:01:27 -06:00
parent d5091c9961
commit 22b964d881
6 changed files with 55 additions and 5 deletions

29
newpost.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
postDir="pages/blog/"
rssFeed="xml/voidblog.xml "
echo "Enter Date"
read name
echo "Enter Title: "
read title
echo "Enter Subtitle: "
read subtitle
echo "Enter Date: "
read date
echo "Enter post type"
read postType
# Modify RSS Feed File with new File Data
rssItem=$(sed "s/#TITLE/$title/g; s/#CATEGORY/$postType/g; s/#LINK/https:\/\/voidwillow.neocities.org\/pages\/templates\/blog\?$name/g; s/#DESCRIPTION/$subtitle/g; s/#DATE/$(date "+%a %d %b %Y %H:%M:%S CST")/g")
#Add new Item to feed below the <!--Feed--> Comment
sed '/<!--Feed-->/a\'$rssItem $rssFeed
#Create new Post from provided info
cd $postDir
if [ -e $name.json ]
then
nvim $name.json
else
cp template.json $name.json
sed -i "s/#TITLE/$title/g; s/#SUBTITLE/$subtitle/g; s/#DATE/$date/g" $name.json
nvim $name.json
fi