summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2023-07-15 04:41:40 -0400
committerSquibid <me@zacharyscheiman.com>2023-07-15 04:41:40 -0400
commit81e150fbd84e0bff8a5d4b80f93a128cabeb4433 (patch)
tree6931c2c515632488cc83990bdd0a6234cbf197d6
parent224a8f75949ecfeec9ef6dc4cd822abb9a6ffed6 (diff)
downloadsite-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.html37
-rwxr-xr-xblog/newblog17
-rwxr-xr-xgen4
-rwxr-xr-xgenblog51
-rw-r--r--index.html24
-rwxr-xr-xscripts/genblog25
-rwxr-xr-xscripts/gengit13
7 files changed, 98 insertions, 73 deletions
diff --git a/blog.html b/blog.html
index 95c4af2..f9cd986 100644
--- a/blog.html
+++ b/blog.html
@@ -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!"
diff --git a/gen b/gen
deleted file mode 100755
index d4894d7..0000000
--- a/gen
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-./scripts/gengit
-./scripts/genblog
diff --git a/genblog b/genblog
new file mode 100755
index 0000000..12bb7fe
--- /dev/null
+++ b/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
diff --git a/index.html b/index.html
index 58cf2be..b4a1ab7 100644
--- a/index.html
+++ b/index.html
@@ -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