New blog entry and changes to how blogs are displayed
- blogs are now in subdirs - blog list is generated through helper function - full blog list is in blog subdir
This commit is contained in:
20
blog/What-is-a-squibid/index.html
Normal file
20
blog/What-is-a-squibid/index.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<meta name="date" content="2023/10/30">
|
||||
<title>'What is a squibid?'</title>
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<link rel="stylesheet" href="/blog/style.css">
|
||||
<body style="background-color: #161617;">
|
||||
<p>
|
||||
Recently, a few people have been asking me: "what is a squibid?" or
|
||||
"where did your name come from?". In this blog post I will answer those
|
||||
questions.
|
||||
<br>
|
||||
<br>
|
||||
A few years ago I came up with a drawing of an animal
|
||||
reason to do anything with it, but regardless I chose to name it a
|
||||
squibid. Eventually, when trying to find a good username I chose squibid
|
||||
because that would cover both the username and profile picture.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
@ -20,23 +20,12 @@
|
||||
<div id="master">
|
||||
<header>
|
||||
<h1 id="font", style="margin-bottom: 0">
|
||||
<a href="https://squi.bid">Squibid's</a> Blog
|
||||
<a href="/">Squibid's</a> Blog
|
||||
</h1>
|
||||
</header>
|
||||
<hr style="color: #f7f7f7;">
|
||||
<p id="bloglist">
|
||||
<?php
|
||||
$path = "blog";
|
||||
$files = scandir($path."/");
|
||||
foreach ($files as $file) {
|
||||
if (preg_match("/.+?(?=\.html|\.php)/", $file, $matches)) {
|
||||
$tags = get_meta_tags($path.'/'.$file);
|
||||
printf('<a href='.$path.'/%s>%s</a><span>%s</span><br>',
|
||||
$matches[0], str_replace("-", " ", $matches[0]),
|
||||
$tags["date"] ? $tags["date"] : "¯\_(ツ)_/¯");
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php include(__DIR__.'/../misc/tools.php'); entries("../blog"); ?>
|
||||
</p>
|
||||
<h2 id="font" style="text-align: center; margin-top: 0;">
|
||||
<a href="/blog/rss.xml", title="rss">subscribe</a>
|
24
blog/newblog
24
blog/newblog
@ -1,23 +1,29 @@
|
||||
#!/bin/sh
|
||||
# generate a base blog file
|
||||
|
||||
read -p "Enter name of blog: " name
|
||||
filename="$(echo $name | sed 's/ /-/g').html"
|
||||
printf "Enter name of blog entry: "
|
||||
read -r name
|
||||
filename="$(echo "$name" | sed 's/ /-/g')"
|
||||
|
||||
# make sure we don't overwrite an existent file
|
||||
[ -f $filename ] &&
|
||||
printf "File already exists! Please choose a different filename.\n"; exit 1
|
||||
# make sure we don't overwrite an existing file
|
||||
if [ -f "$filename" ]; then
|
||||
printf "Blog entry already exists! Please choose a different name.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '<!DOCTYPE HTML>
|
||||
mkdir "$filename"
|
||||
cat > "$filename/index.html" << EOF
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<meta name="date" content="2023/07/15"><title>'$name'</title>
|
||||
<title>'$name'</title>
|
||||
<meta name="date" content="$(date "+%Y/%m/%d")">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<body style="background-color: #161617;">
|
||||
<p>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
' > $filename
|
||||
$EDITOR $filename
|
||||
EOF
|
||||
[ "$EDITOR" ] && $EDITOR "$filename/index.html" || vim "$filename/index.html"
|
||||
|
||||
echo "Make sure to run sup to add to rss feed!"
|
||||
|
40
blog/rss.xml
40
blog/rss.xml
@ -11,10 +11,38 @@
|
||||
|
||||
<!-- LB -->
|
||||
|
||||
<item>
|
||||
<title>What is a squibid?</title>
|
||||
<guid>https://squi.bid/blog/What-is-a-squibid/index.html</guid>
|
||||
<link>https://squi.bid/blog/What-is-a-squibid/index.html</link>
|
||||
<pubDate>Mon, 30 Oct 2023 12:47:05 -0400</pubDate>
|
||||
<description><![CDATA[<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<meta name="date" content="2023/10/30">
|
||||
<title>'What is a squibid?'</title>
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<link rel="stylesheet" href="/blog/style.css">
|
||||
<body style="background-color: #161617;">
|
||||
<p>
|
||||
Recently, a few people have been asking me: "what is a squibid?" or
|
||||
"where did your name come from?". In this blog post I will answer those
|
||||
questions.
|
||||
<br>
|
||||
<br>
|
||||
A few years ago I came up with a drawing of an animal
|
||||
reason to do anything with it, but regardless I chose to name it a
|
||||
squibid. Eventually, when trying to find a good username I chose squibid
|
||||
because that would cover both the username and profile picture.
|
||||
</p>
|
||||
|
||||
]]></description>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<title>librex and dots</title>
|
||||
<guid>https://squi.bid/blog/librex-and-dots.html</guid>
|
||||
<link>https://squi.bid/blog/librex-and-dots.html</link>
|
||||
<guid>https://squi.bid/blog/librex-and-dots</guid>
|
||||
<link>https://squi.bid/blog/librex-and-dots</link>
|
||||
<pubDate>Tue, 27 Jun 2023 12:17:35 -0400</pubDate>
|
||||
<description><![CDATA[
|
||||
<p>
|
||||
@ -43,8 +71,8 @@ feel free to <a href="mailto:me@zacharyscheiman.com">email me</a>.
|
||||
|
||||
<item>
|
||||
<title>It's Alive!</title>
|
||||
<guid>https://squi.bid/blog/It's-Alive!.html</guid>
|
||||
<link>https://squi.bid/blog/It's-Alive!.html</link>
|
||||
<guid>https://squi.bid/blog/It's-Alive!</guid>
|
||||
<link>https://squi.bid/blog/It's-Alive!</link>
|
||||
<pubDate>Mon, 17 Apr 2023 13:22:03 +0000</pubDate>
|
||||
<description><![CDATA[
|
||||
<p>
|
||||
@ -58,8 +86,8 @@ feel free to <a href="mailto:me@zacharyscheiman.com">email me</a>.
|
||||
|
||||
<item>
|
||||
<title>state of the site</title>
|
||||
<guid>https://squi.bid/blog/state-of-the-site.html</guid>
|
||||
<link>https://squi.bid/blog/state-of-the-site.html</link>
|
||||
<guid>https://squi.bid/blog/state-of-the-site</guid>
|
||||
<link>https://squi.bid/blog/state-of-the-site</link>
|
||||
<pubDate>Sat, 11 Mar 2023 15:00:32 -0500</pubDate>
|
||||
<description><![CDATA[
|
||||
<p>
|
||||
|
19
index.php
19
index.php
@ -64,24 +64,9 @@
|
||||
</p>
|
||||
</hgroup>
|
||||
<p id="blogpreview">
|
||||
<?php
|
||||
$path = "blog";
|
||||
$files = scandir($path."/");
|
||||
$i = 0;
|
||||
foreach ($files as $file) {
|
||||
if (preg_match("/.+?(?=\.html|\.php)/", $file, $matches)) {
|
||||
if ($i > 4)
|
||||
break;
|
||||
$tags = get_meta_tags($path.'/'.$file);
|
||||
printf('<a href='.$path.'/%s>%s</a><span>%s</span><br>',
|
||||
$matches[0], str_replace("-", " ", $matches[0]),
|
||||
$tags["date"] ? $tags["date"] : "¯\_(ツ)_/¯");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php include('misc/tools.php'); entries("blog", 5); ?>
|
||||
</p>
|
||||
<a href="/blog.php">more...</a>
|
||||
<a href="/blog">more...</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
27
misc/tools.php
Normal file
27
misc/tools.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
function entries($path = "blog", $limit = false) {
|
||||
$files = scandir($path."/");
|
||||
$entries = [];
|
||||
$i = 0;
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (is_dir($path.'/'.$file) && $file[0] != ".") {
|
||||
$tags = get_meta_tags($path.'/'.$file.'/index.html');
|
||||
$entries[$i][0] = preg_replace("/\//", "", $tags["date"]);
|
||||
$entries[$i][1] = $file;
|
||||
$entries[$i][2] = $tags["date"];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
rsort($entries);
|
||||
for ($i = 0; $i < count($entries); $i++) {
|
||||
if ($limit && $i > $limit - 1)
|
||||
break;
|
||||
$file = $entries[$i][1];
|
||||
$age = $entries[$i][2];
|
||||
printf('<a href=/%s/%s>%s</a><span>%s</span><br>',
|
||||
$path, $file, str_replace("-", " ", $file),
|
||||
$age ? $age : "¯\_(ツ)_/¯");
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user