Created build script for creating pages with templates

This commit is contained in:
2025-03-10 21:10:31 -07:00
parent ff7a64ba6d
commit f8eb75f2bc
2 changed files with 8 additions and 8 deletions

12
blog.sh
View File

@@ -2,7 +2,7 @@
# Site specific settings # Site specific settings
DOMAIN="https://iiogama.0x212.com" DOMAIN="https://iiogama.0x212.com"
TITLE="Just some dude creating things" TITLE="Some dude doing stuff"
DESCRIPTION="iiogama@0x212.com" DESCRIPTION="iiogama@0x212.com"
COPYRIGHT="Copyright $(date +%Y), Thai Noodles" COPYRIGHT="Copyright $(date +%Y), Thai Noodles"
AUTHOR="Thai Noodles, (iiogama@0x212.com)" AUTHOR="Thai Noodles, (iiogama@0x212.com)"
@@ -41,19 +41,19 @@ function build_feed() {
<copyright>$COPYRIGHT</copyright> <copyright>$COPYRIGHT</copyright>
<ttl>$TTL</ttl>" >> "$OUTPUT_DIR/$FEED_FILE" <ttl>$TTL</ttl>" >> "$OUTPUT_DIR/$FEED_FILE"
find $OUTPUT_DIR/$BLOG_DIR -type f -name "*.html" | while read file; do find $OUTPUT_DIR/$BLOG_DIR -type f -name "*.html" | while read file; do
POST_DATE="$(date -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%a, %d %b %Y %H:%M:%S")" POST_DATE="$(date -d "$(sed -n 's|<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%a, %d %b %Y %H:%M:%S")"
CAT_DATE="$(date -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%Y/%m/%d/%u")" CAT_DATE="$(date -d "$(sed -n 's|<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%Y/%m/%d/%u")"
POST_TITLE="$(sed -n 's|^<h1 class="title">\([^<]*\)</h1>$|\1|p' $file)" POST_TITLE="$(sed -n 's|<h1 class="title">\([^<]*\)</h1>$|\1|p' $file)"
POST_CONTENT="$(sed -n '/<article>/,/<\/article>/p' $file | sed -e '1s/.*<article>//' -e '$s/<\/article>.*//')" POST_CONTENT="$(sed -n '/<article>/,/<\/article>/p' $file | sed -e '1s/.*<article>//' -e '$s/<\/article>.*//')"
echo " echo "
<item> <item>
<pubDate>$POST_DATE PST</pubDate> <pubDate>$POST_DATE PST</pubDate>
<category>$CAT_DATE</category> <category>$CAT_DATE</category>
<title>$POST_TITLE</title> <title>$POST_TITLE</title>
<link>$DOMAIN/$BLOG_DIR$(basename ${file})</link> <link>$DOMAIN/$BLOG_DIR/$(basename ${file})</link>
<description><![CDATA[$POST_CONTENT]]></description> <description><![CDATA[$POST_CONTENT]]></description>
<author>$AUTHOR</author> <author>$AUTHOR</author>
<guid>$DOMAIN/$BLOG_DIR$(basename ${file})</guid> <guid>$DOMAIN/$BLOG_DIR/$(basename ${file})</guid>
</item>" >> "$OUTPUT_DIR/$FEED_FILE" </item>" >> "$OUTPUT_DIR/$FEED_FILE"
done done
echo "</channel> echo "</channel>

View File

@@ -14,4 +14,4 @@ deploy:
rclone sync ./_output/ iiogama.0x212.com:public/ rclone sync ./_output/ iiogama.0x212.com:public/
clean: clean:
rm -r _output/* && rmdir _output/ mkdir -p _output/ && rm -r _output/* && rmdir _output/