diff options
author | Squibid <me@zacharyscheiman.com> | 2023-07-15 04:41:40 -0400 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2023-07-15 04:41:40 -0400 |
commit | 81e150fbd84e0bff8a5d4b80f93a128cabeb4433 (patch) | |
tree | 6931c2c515632488cc83990bdd0a6234cbf197d6 | |
parent | 224a8f75949ecfeec9ef6dc4cd822abb9a6ffed6 (diff) | |
download | site-81e150fbd84e0bff8a5d4b80f93a128cabeb4433.tar.gz site-81e150fbd84e0bff8a5d4b80f93a128cabeb4433.tar.bz2 site-81e150fbd84e0bff8a5d4b80f93a128cabeb4433.zip |
new genblog script, remove old gen scripts new blog layout
Diffstat (limited to '')
-rw-r--r-- | blog.html | 37 | ||||
-rwxr-xr-x | blog/newblog | 17 | ||||
-rwxr-xr-x | gen | 4 | ||||
-rwxr-xr-x | genblog | 51 | ||||
-rw-r--r-- | index.html | 24 | ||||
-rwxr-xr-x | scripts/genblog | 25 | ||||
-rwxr-xr-x | scripts/gengit | 13 |
7 files changed, 98 insertions, 73 deletions
@@ -7,32 +7,33 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <style type="text/css"> - p { - font-size: 2.5vw; + #bloglist { + text-align: left; + font-size: 2ch; } - #date { - font-size: 1.5vw; + p#bloglist span { float: right; color: white; } - #svg { - display: block; - margin-left: auto; - margin-right: auto; - width: 50%; - max-height: 1.5em; - max-width: 1.5em; - } </style> - <body> - <div class="master"> + <body style="background-color: #161617;"> + <div id="master"> <header> - <h1 id="font"><a href="https://squi.bid">Squibid's</a> Blog</h1> + <h1 id="font", style="margin-bottom: 0"> + <a href="https://squi.bid">Squibid's</a> Blog + </h1> </header> <hr style="color: #f7f7f7;"> - <p> <!-- script marker blog --> - </p> <!-- script marker blog --> - <a href="https://squi.bid/blog/rss.xml"><img id="svg" src="pics/rss.svg" alt="rss feed"></a> + <p id="bloglist"> + <!-- b script marker blog --> +<a href="/blog/librex-and-dots"> librex and dots</a><span>2023/06/27</span><br> +<a href="/blog/It's-Alive!"> It's Alive!</a><span>2023/05/01</span><br> +<a href="/blog/state-of-the-site"> state of the site</a><span>2023/03/11</span><br> + <!-- e script marker blog --> + </p> + <h2 id="font" style="text-align: center; margin-top: 0;"> + <a href="/blog/rss.xml", title="rss">subscribe</a> + </h2> </div> </body> </html> diff --git a/blog/newblog b/blog/newblog index da0def9..2cd5ca3 100755 --- a/blog/newblog +++ b/blog/newblog @@ -3,6 +3,21 @@ read -p "Enter name of blog: " name filename="$(echo $name | sed 's/ /-/g').html" -printf "<title>$name</title>\n<link rel="stylesheet" href="style.css">\n<body>\n<p>\n</p>\n</body>" > $filename + +# make sure we don't overwrite an existent file +[ -f $filename ] && + printf "File already exists! Please choose a different filename.\n"; exit 1 + +printf '<!DOCTYPE HTML> +<html lang="en"> + <meta name="date" content="2023/07/15"><title>'$name'</title> + <link rel=stylesheet href=style.css> + <body style="background-color: #161617;"> + <p> + </p> + </body> +</html> +' > $filename $EDITOR $filename + echo "Make sure to run sup to add to rss feed!" @@ -1,4 +0,0 @@ -#!/bin/sh - -./scripts/gengit -./scripts/genblog @@ -0,0 +1,51 @@ +#!/bin/sh +# +# genblog is a script to take data from my blogs and format it into html for +# my website +# +# by: Squibid +# + +# +# Helper variables and functions +# +bloglist=$(ls -t1 blog/*.html | grep -oP '(?<=\/).*?(?=\.)') +top5=$(printf "$bloglist\n" | head -5) + +blogdate() { + grep -oP '(?<=\<meta name="date" content=").*(?="\>)' "blog/$1.html" +} +blogtitle() { grep -oP '(?<=\<title\>).*(?=\<\/title\>)' "blog/$1.html"; } +htmlline() { + printf "<a href=\"/blog/$1\">\ $(blogtitle $1)</a>\ +<span>$(blogdate $1)</span><br>\n" +} + +# set file dates properly +for i in $bloglist; do + if $(touch -cd "$(blogdate $i)T00:00:00" /tmp/file); then + touch -amt "$(blogdate $i | sed 's/\///g')0000" "blog/$i.html" + fi +done + +# +# Start modifing our files +# + +# delete old bloglist +sed -i -n '1,/.*<!-- b script marker blog -->/p;/.*<!-- e script marker blog -->/,$p' index.html +sed -i -n '1,/.*<!-- b script marker blog -->/p;/.*<!-- e script marker blog -->/,$p' blog.html + +# top 5 blogs +for i in $top5; do + line=$(htmlline $i) + # add new bloglist + sed -i "/.*<!-- e script marker blog -->/i $line" index.html +done + +# generate the full blog list +for i in $bloglist; do + line=$(htmlline $i) + # add new bloglist + sed -i "/.*<!-- e script marker blog -->/i $line" blog.html +done @@ -32,19 +32,19 @@ </div> </div> <div id="right"> - <div> <!-- Blog Section --> - <h2 id="font"><a href="https://squi.bid/blog/rss.xml"><img id="svg" src="pics/rss.svg" alt="rss feed"></a> My Blog</h2> - <p> <!-- script marker blog --> - </p> <!-- script marker blog --> - <a href="blog">more...</a> - </div> - <div> <!-- Reasoning Section --> - <h2 id="font"> Why Tho?</h2> - <p> Idk I felt like it. Most of the useful stuff - will be over at the <a href="https://git.squi.bid">git</a> - subdomain. Or you can find a shortened list under the - "Git Repos" section. + <div id="group"> <!-- Blog Section --> + <hgroup> + <h2 id="font", style="margin-bottom: 0;">My Blog</h2> + <p style="text-align: center; margin-top: 0;"> + <a href="/blog/rss.xml", title="rss">subscribe</a> + </p> + </hgroup> + <p id="blogpreview"> + <!-- b script marker blog --> + If this is here I forgot to generate the blog list. + <!-- e script marker blog --> </p> + <a href="/blog">more...</a> </div> </div> </div> diff --git a/scripts/genblog b/scripts/genblog deleted file mode 100755 index e77f85f..0000000 --- a/scripts/genblog +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 diff --git a/scripts/gengit b/scripts/gengit deleted file mode 100755 index 91a0b20..0000000 --- a/scripts/gengit +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -repos=$(ls -1 /var/git | grep -o '.*\.git' | head -5) - -# delete old list -sed -i -n '1,/ <p> <!-- script marker git -->/p;/ <\/p> <!-- script marker git -->/,$p' index.html - -for i in $repos ; do - name=$(echo $i | sed 's/\.git//') - line="<a href=\"https://git.squi.bid/$name\">$name</a><br>" - # add new repo - sed -i "/ <\/p> <!-- script marker git -->/i $line" index.html -done |