aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-05-07 23:02:24 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-05-07 23:02:24 +0200
commitd90aebe04f9db8233801b358c5074230ada466eb (patch)
tree1f8e5c53f1c1b473d1657496617344f894e85032
parent462f75b7e0ba21a46f1498740b8840796381a6b1 (diff)
downloadblog-d90aebe04f9db8233801b358c5074230ada466eb.tar.gz
blog-d90aebe04f9db8233801b358c5074230ada466eb.tar.bz2
blog-d90aebe04f9db8233801b358c5074230ada466eb.zip
added web files
-rwxr-xr-xblogarticledate3
-rw-r--r--index.php112
-rw-r--r--search.php93
-rw-r--r--sticky.php72
-rw-r--r--style.css154
5 files changed, 434 insertions, 0 deletions
diff --git a/blogarticledate b/blogarticledate
index 845ddcf..888f06a 100755
--- a/blogarticledate
+++ b/blogarticledate
@@ -1,5 +1,8 @@
#!/bin/sh
+# resets blog articles file date to the date indicated
+# in the article
+
postArray=( $(ls *.html) )
for posts in "${postArray[@]}"; do
post=$posts
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..9fdc8f3
--- /dev/null
+++ b/index.php
@@ -0,0 +1,112 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" href="/style.css">
+ <link rel="icon" type="image/x-icon" href="/favicon.ico">
+ <meta property="og:image" content="https://wittamore.com/images/bloggings.jpg">
+ <meta property="og:image:type" content="image/jpg">
+ <meta property="og:image:width" content="1024">
+ <meta property="og:image:height" content="640">
+ <title>Bloggings</title>
+</head>
+<body>
+ <header>
+ <h1>Bloggings</h1>
+ <p><b>Blog</b>&nbsp;|&nbsp;<a href="sticky.php">Sticky</a>&nbsp;|&nbsp;<a
+ href="search.php">Search</a>&nbsp;|&nbsp;<a
+ href="https://wittamore-com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en-GB&_x_tr_pto=wapp">Français</a>&nbsp;|&nbsp;<a
+ href="https://git.wittamore.com" target="_blank" title="Git">Git</a>&nbsp;|&nbsp;<a
+ href="https://wittamore.com/rss.xml" target="_blank" title="RSS">RSS</a>&nbsp;|&nbsp;<a
+ href="https://bsky.app/profile/wittamore.com" target="_blank">Bluesky</a></p>
+ <hr>
+ <p>This is my personal <a href="/articles/2023/minimalist-blog.html">minimalist blog</a>.
+ It has no Javascript, cookies or bloat, it won't track you or sell your soul and can be viewed in any browser.
+ <a href="/sticky/Mention-Legal.html">GDPR notice</a></p>
+ </header>
+ <!-- list start -->
+<?php
+// build reverse article subdirs (years)
+$yeardirs = [];
+$revyeardirs = [];
+$articlesubdir = new DirectoryIterator("./articles/");
+foreach ($articlesubdir as $dirinfo) {
+ if ($dirinfo->isDir() && !$dirinfo->isDot()) {
+ $yeardirs[] = $dirinfo->getFilename();
+ }
+}
+rsort($yeardirs);
+// iterate through years
+if (is_array($yeardirs)) {
+ foreach ($yeardirs as $key => $dirname) {
+ echo "<h2>" . $dirname . "</h2>";
+ echo "<ul>";
+ $items = [];
+ $thisdir = new DirectoryIterator("./articles/" . $dirname);
+ // iterate through files
+ foreach ($thisdir as $file) {
+ if (!$file->isDot()) {
+ $flag = "";
+ $articledate = date("Y-m-d");
+ $filemodified = date("Y-m-d", filemtime("./articles/".$dirname."/".$file));
+ $content = file_get_contents($file->getPathname());
+ preg_match("/<h5>(.*?)<\/h5>/s", $content, $date);
+ if (isset($date[1]) && strtotime($date[1])) {
+ $articledate = date("Y-m-d", strtotime($date[1]));
+ }
+ // 2025-04-18 was the last global update
+ if (($filemodified > $articledate) &&
+ ($filemodified != "2025-04-18") &&
+ ($filemodified >= date('Y-m-d', strtotime(date("Y-m-d"). ' - 7 days')))) $flag = "Updated";
+ if ($articledate >= date('Y-m-d', strtotime(date("Y-m-d"). ' - 2 days'))) $flag = "New";
+ preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
+ $title = "?";
+ if (isset($titre[1])) {
+ $title = ucfirst($titre[1]);
+ }
+
+ $items[] =
+ '<li style="list-style-type:none;">' .
+ substr($articledate, -5 ) . '&nbsp;' .
+ '<a target="blank" href="' .
+ $file->getPathname() .
+ '">' .
+ $title .
+ "</a><small><i>&nbsp;" . $flag . "</i></small></li>";
+ }
+ }
+
+ rsort($items);
+ foreach ($items as $key => $val) {
+ echo $val;
+ }
+ echo "</ul>";
+ }
+} else {
+ echo "Not an array";
+}
+?>
+<!-- list end -->
+ <p>&nbsp;</p>
+ <hr>
+ <p>§</p>
+</body>
+</html>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/search.php b/search.php
new file mode 100644
index 0000000..72d65c4
--- /dev/null
+++ b/search.php
@@ -0,0 +1,93 @@
+<?php
+$string = "";
+if (isset($_POST["s"])) {
+ $string = htmlspecialchars($_POST["s"]);
+}
+?>
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="stylesheet" href="/style.css" />
+ <link rel="icon" type="image/x-icon" href="/favicon.ico">
+ <title>Bloggings</title>
+ </head>
+ <body>
+ <header>
+ <h1>Bloggings</h1>
+ <p><a href="index.php">Blog</a>&nbsp;|&nbsp;<a
+ href="sticky.php">Sticky</a>&nbsp;|&nbsp;<b>Search</b>&nbsp;|&nbsp;<a
+ href="https://wittamore-com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en-GB&_x_tr_pto=wapp">Français</a>&nbsp;|&nbsp;<a
+ href="https://git.wittamore.com" target="_blank" title="Git">Git</a>&nbsp;|&nbsp;<a
+ href="rss.xml">RSS</a>&nbsp;|&nbsp;<a
+ href="https://bsky.app/profile/wittamore.com" target="_blank">Bluesky</a></p>
+ <hr />
+ </header>
+ <h2>Search this blog</h2>
+ <form action="search.php" method="post">
+ <input name="s" type="text" autofocus>
+ <input type="submit">
+ </form>
+ <!-- list start -->
+
+<?php if (!empty($string)) {
+ $string = strtolower($string);
+ echo "<h2>Results</h2>";
+ echo 'Search terms: <b>"' . $string . '"</b>';
+ echo "<h3>Static Pages</h3>";
+ $dir = new RecursiveDirectoryIterator("./sticky");
+ echo "<ul>";
+ $i=0;
+ foreach (new RecursiveIteratorIterator($dir) as $filename => $file) {
+ if ($file != "." && $file != "..") {
+ if (!is_dir($file)) {
+ $content = strtolower(file_get_contents($file->getPathname()));
+ if (strpos($content, $string) !== false) {
+ $i++;
+ preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
+ $title = "?";
+ if (isset($titre[1])) {
+ $title = ucfirst($titre[1]);
+ }
+ echo '<li><a href="' . $file . '">' . $title . "</a></li>";
+ }
+ }
+ }
+ }
+ if ($i == 0) echo "<i>No match</i>";
+ echo "</ul>";
+ echo "<h3>Articles</h3>";
+ $dir = new RecursiveDirectoryIterator("./articles");
+ echo "<ul>";
+ $i=0;
+ foreach (new RecursiveIteratorIterator($dir) as $filename => $file) {
+ if ($file != "." && $file != "..") {
+ if (!is_dir($file)) {
+ $content = strtolower(file_get_contents($file->getPathname()));
+ if (strpos($content, $string) !== false) {
+ $i++;
+ preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
+ $title = "?";
+ if (isset($titre[1])) {
+ $title = ucfirst($titre[1]);
+ }
+ echo '<li><a href="' . $file . '">' . $title . "</a></li>";
+ }
+ }
+ }
+ }
+ if ($i == 0) echo "<i>No match</i>";
+ echo "</ul>";
+} ?>
+
+ <!-- list end -->
+ <p>&nbsp;</p>
+ <hr />
+ <p>§</p>
+ </body>
+</html>
+
+
+
+
diff --git a/sticky.php b/sticky.php
new file mode 100644
index 0000000..abf6650
--- /dev/null
+++ b/sticky.php
@@ -0,0 +1,72 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="stylesheet" href="/style.css" />
+ <link rel="icon" type="image/x-icon" href="/favicon.ico">
+ <title>Bloggings</title>
+</head>
+<body>
+ <header>
+ <h1>Bloggings</h1>
+ <p><a href="index.php">Blog</a>&nbsp;|&nbsp;<b>Sticky</b>&nbsp;|&nbsp;<a
+ href="search.php">Search</a>&nbsp;|&nbsp;<a
+ href="https://wittamore-com.translate.goog/?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en-GB&_x_tr_pto=wapp">Français</a>&nbsp;|&nbsp;<a
+ href="https://git.wittamore.com" target="_blank" title="Git">Git</a>&nbsp;|&nbsp;<a
+ href="rss.xml">RSS</a>&nbsp;|&nbsp;<a
+ href="https://bsky.app/profile/wittamore.com" target="_blank">Bluesky</a></p>
+ <hr />
+ </header>
+ <h2>Sticky pages</h2>
+ <!-- list start -->
+<?php
+// iterate through years
+$items = [];
+echo "<ul>";
+// iterate through files
+$i = 0;
+$thisdir = new DirectoryIterator("./sticky");
+foreach ($thisdir as $file) {
+ if ((!$file->isDot()) && (!$file->isDir())) {
+ $i++;
+ $content = file_get_contents($file->getPathname());
+ preg_match("/<h5>(.*?)<\/h5>/s", $content, $date);
+ $filedate = date("Y-m-d");
+
+ if (isset($date[1]) && strtotime($date[1])) {
+ $filedate = date("Y-m-d", strtotime($date[1]));
+ }
+
+ preg_match("/<h2>(.*?)<\/h2>/s", $content, $titre);
+ $title = "?";
+
+ if (isset($titre[1])) {
+ $title = ucfirst($titre[1]);
+ }
+ $items[$i][0] = $i;
+ $items[$i][1] = $file->getPathname();
+ $items[$i][2] = $title;
+ }
+}
+$values = array_column($items, 2);
+array_multisort($values, SORT_ASC, $items);
+
+$i = 0;
+while ($i < count($items)) {
+ echo "<li>" .
+ '<a href="' .
+ $items[$i][1] .
+ '">' .
+ ucfirst($items[$i][2]) .
+ "</a></li>";
+ $i++;
+}
+echo "</ul>";
+?>
+<!-- list end -->
+ <p>&nbsp;</p>
+ <hr />
+ <p>§</p>
+ </body>
+</html>
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..4d7716b
--- /dev/null
+++ b/style.css
@@ -0,0 +1,154 @@
+@font-face {
+ font-family: 'Ultra';
+ src: url('fonts/Ultra-Regular-reduced.ttf') format('truetype');
+}
+
+body,
+html {
+ height: 100%;
+ color: #FBF1C7;
+ margin: 10px;
+ font-family: monospace;
+ font-size: 18px;
+ line-height:1.4;
+ letter-spacing: 0.6;
+ background-color: #1D2021;
+}
+html {
+ display: table;
+ margin: auto;
+ width:100%;
+ max-width:80ch;
+}
+body {
+ display: table-cell;
+}
+p,li,ul,table,pre,code,div {
+ max-width: 32em;
+ max-width: 80ch;
+ text-align:justify;
+}
+li {list-style-type: disc;}
+h1 {
+ color: #458588;
+ font-family: Ultra;
+ font-size:3em;
+}
+h2 {
+ color: #8EC07C;
+}
+h3{
+ color: #cc241d;
+}
+h4{
+ color: #689D6A;
+ font-size:1.2em;
+}
+h5,
+h6 {
+ color: #A89984;
+ font-size: 1em;
+}
+a {
+ color: #83A598;
+ text-decoration: none;
+}
+a:hover {
+ text-decoration: underline;
+}
+ul {line-height:2;}
+p {
+}
+strong,
+em {
+ color: #8da29b;
+ padding-left: 2px;
+ padding-right: 2px;
+}
+b {color: #FABD2F;}
+
+small {color: #8ec07c;}
+img {
+ max-width:100%;
+}
+blockquote {
+ border-left:2px solid khaki;
+ padding-left:20px;
+ margin-left:0px;
+}
+blockquote p {
+ font-style: italic;
+}
+hr {
+ height: 0;
+ border: 0;
+ border-top: 2px solid #458588;
+ margin: 1em 0;
+ padding: 0;
+}
+table {
+ border-collapse: collapse;
+}
+td {
+ border: 1px solid antiquewhite;
+ padding: 4px;
+}
+th {
+ border: 1px solid antiquewhite;
+ color: black;
+ background-color: antiquewhite;
+ padding: 4px;
+ text-align: div class="center";
+}
+pre {
+ font-family: monospace;
+ white-space: pre-wrap;
+ font-size: 0.8em;
+ border-left: 1px solid #999999;
+ padding: 10px;
+ text-align:left;
+}
+code {
+ color: #282828;
+ font-family: monospace;
+ background: #928374;
+ white-space: pre-wrap;
+ display:block;
+ padding:4px;
+ text-align:left;
+}
+iframe { border: 1px solid #928374;}
+
+figure {
+ margin: 0;
+ margin-top:30px;
+ background: #8EC07C;
+ width:400px;
+ }
+figure img {
+ width:400px;
+}
+figcaption {
+ margin-bottom:10px;
+ padding: 10px;
+ background: #8EC07C;
+ color: #fff;
+ font-size:16px;
+ width:380px;
+}
+.center {text-align: center;}
+@media only screen and (max-width: 600px) {
+ body {
+ padding:2px;
+ font-size:14px;
+ margin: 0;
+ }
+ ul {padding:0;}
+ li {
+ padding:0;
+ text-align:left;
+ }
+ iframe {
+ max-width:100%;
+ }
+}