diff options
author | squibid <me@zacharyscheiman.com> | 2023-03-11 12:41:48 -0500 |
---|---|---|
committer | squibid <me@zacharyscheiman.com> | 2023-03-11 12:41:48 -0500 |
commit | 721630bec0f887e1bb2f9c5e7135b560318208c8 (patch) | |
tree | b624f613af81e01d462e9ae400a07a08af95ef47 /scripts/genblog | |
parent | 53ba59c39dab56533ec965bfdfc28bd98ab38db0 (diff) | |
download | site-721630bec0f887e1bb2f9c5e7135b560318208c8.tar.gz site-721630bec0f887e1bb2f9c5e7135b560318208c8.tar.bz2 site-721630bec0f887e1bb2f9c5e7135b560318208c8.zip |
rewrite site and stop using iframes
Diffstat (limited to 'scripts/genblog')
-rwxr-xr-x | scripts/genblog | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/genblog b/scripts/genblog new file mode 100755 index 0000000..e77f85f --- /dev/null +++ b/scripts/genblog @@ -0,0 +1,25 @@ +#!/bin/sh + +blogs=$(ls -ct1 blog/*.html) +blogs5=$(ls -ct1 blog/*.html | head -5) +date() { + ls -ct1l --time-style=+'%Y %b %d' $1 | cut -d ' ' -f 6-8 +} +# delete old bloglist +sed -i -n '1,/ <p> <!-- script marker blog -->/p;/ <\/p> <!-- script marker blog -->/,$p' index.html +sed -i -n '1,/ <p> <!-- script marker blog -->/p;/ <\/p> <!-- script marker blog -->/,$p' blog.html + +# top 5 blogs +for i in $blogs5; do + name=$(echo $i | sed 's/blog\///' | sed 's/\..*//' | sed 's/-/ /g') + line="<a href=\"https://squi.bid/$(echo $i | sed 's/\.html//')\">$name</a> [$(date $i)]<br>" + # add new bloglist + sed -i "/\ <\/p> <!-- script marker blog -->/i $line" index.html +done +# full blog +for i in $blogs; do + name=$(echo $i | sed 's/blog\///' | sed 's/\..*//' | sed 's/-/ /g') + line="<a href=\"https://squi.bid/$(echo $i | sed 's/\.html//')\">$name<span id=\"date\">$(date $i)</span></a><br>" + # add new bloglist + sed -i "/ <\/p> <!-- script marker blog -->/i $line" blog.html +done |