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">
|
<div id="master">
|
||||||
<header>
|
<header>
|
||||||
<h1 id="font", style="margin-bottom: 0">
|
<h1 id="font", style="margin-bottom: 0">
|
||||||
<a href="https://squi.bid">Squibid's</a> Blog
|
<a href="/">Squibid's</a> Blog
|
||||||
</h1>
|
</h1>
|
||||||
</header>
|
</header>
|
||||||
<hr style="color: #f7f7f7;">
|
<hr style="color: #f7f7f7;">
|
||||||
<p id="bloglist">
|
<p id="bloglist">
|
||||||
<?php
|
<?php include(__DIR__.'/../misc/tools.php'); entries("../blog"); ?>
|
||||||
$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"] : "¯\_(ツ)_/¯");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</p>
|
</p>
|
||||||
<h2 id="font" style="text-align: center; margin-top: 0;">
|
<h2 id="font" style="text-align: center; margin-top: 0;">
|
||||||
<a href="/blog/rss.xml", title="rss">subscribe</a>
|
<a href="/blog/rss.xml", title="rss">subscribe</a>
|
24
blog/newblog
24
blog/newblog
@ -1,23 +1,29 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# generate a base blog file
|
# generate a base blog file
|
||||||
|
|
||||||
read -p "Enter name of blog: " name
|
printf "Enter name of blog entry: "
|
||||||
filename="$(echo $name | sed 's/ /-/g').html"
|
read -r name
|
||||||
|
filename="$(echo "$name" | sed 's/ /-/g')"
|
||||||
|
|
||||||
# make sure we don't overwrite an existent file
|
# make sure we don't overwrite an existing file
|
||||||
[ -f $filename ] &&
|
if [ -f "$filename" ]; then
|
||||||
printf "File already exists! Please choose a different filename.\n"; exit 1
|
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">
|
<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">
|
<link rel="stylesheet" href="/style.css">
|
||||||
<body style="background-color: #161617;">
|
<body style="background-color: #161617;">
|
||||||
<p>
|
<p>
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
' > $filename
|
EOF
|
||||||
$EDITOR $filename
|
[ "$EDITOR" ] && $EDITOR "$filename/index.html" || vim "$filename/index.html"
|
||||||
|
|
||||||
echo "Make sure to run sup to add to rss feed!"
|
echo "Make sure to run sup to add to rss feed!"
|
||||||
|
40
blog/rss.xml
40
blog/rss.xml
@ -11,10 +11,38 @@
|
|||||||
|
|
||||||
<!-- LB -->
|
<!-- 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>
|
<item>
|
||||||
<title>librex and dots</title>
|
<title>librex and dots</title>
|
||||||
<guid>https://squi.bid/blog/librex-and-dots.html</guid>
|
<guid>https://squi.bid/blog/librex-and-dots</guid>
|
||||||
<link>https://squi.bid/blog/librex-and-dots.html</link>
|
<link>https://squi.bid/blog/librex-and-dots</link>
|
||||||
<pubDate>Tue, 27 Jun 2023 12:17:35 -0400</pubDate>
|
<pubDate>Tue, 27 Jun 2023 12:17:35 -0400</pubDate>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<p>
|
<p>
|
||||||
@ -43,8 +71,8 @@ feel free to <a href="mailto:me@zacharyscheiman.com">email me</a>.
|
|||||||
|
|
||||||
<item>
|
<item>
|
||||||
<title>It's Alive!</title>
|
<title>It's Alive!</title>
|
||||||
<guid>https://squi.bid/blog/It's-Alive!.html</guid>
|
<guid>https://squi.bid/blog/It's-Alive!</guid>
|
||||||
<link>https://squi.bid/blog/It's-Alive!.html</link>
|
<link>https://squi.bid/blog/It's-Alive!</link>
|
||||||
<pubDate>Mon, 17 Apr 2023 13:22:03 +0000</pubDate>
|
<pubDate>Mon, 17 Apr 2023 13:22:03 +0000</pubDate>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<p>
|
<p>
|
||||||
@ -58,8 +86,8 @@ feel free to <a href="mailto:me@zacharyscheiman.com">email me</a>.
|
|||||||
|
|
||||||
<item>
|
<item>
|
||||||
<title>state of the site</title>
|
<title>state of the site</title>
|
||||||
<guid>https://squi.bid/blog/state-of-the-site.html</guid>
|
<guid>https://squi.bid/blog/state-of-the-site</guid>
|
||||||
<link>https://squi.bid/blog/state-of-the-site.html</link>
|
<link>https://squi.bid/blog/state-of-the-site</link>
|
||||||
<pubDate>Sat, 11 Mar 2023 15:00:32 -0500</pubDate>
|
<pubDate>Sat, 11 Mar 2023 15:00:32 -0500</pubDate>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<p>
|
<p>
|
||||||
|
19
index.php
19
index.php
@ -64,24 +64,9 @@
|
|||||||
</p>
|
</p>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
<p id="blogpreview">
|
<p id="blogpreview">
|
||||||
<?php
|
<?php include('misc/tools.php'); entries("blog", 5); ?>
|
||||||
$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++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</p>
|
</p>
|
||||||
<a href="/blog.php">more...</a>
|
<a href="/blog">more...</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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