Added simple blog engine and a md2html converter script
authorLukas Krickl <lukas@krickl.dev>
Sun, 22 Jun 2025 06:44:13 +0000 (08:44 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 22 Jun 2025 06:44:13 +0000 (08:44 +0200)
.gitignore
README.md
blog.html [new file with mode: 0644]
blog/2025-06-22-hello-blog.md [new file with mode: 0644]
contact.html [new file with mode: 0644]
index.html
md2html.sh [new file with mode: 0755]

index f40fbd8ba564ea28e0a2501e2921909467b39887..19c49ccafe4390e10a587f8f9d582a7d2f342ae8 100644 (file)
@@ -1,5 +1,2 @@
-_site
-.sass-cache
-.jekyll-cache
-.jekyll-metadata
-vendor
+blog/*.html
+atom.xml
index 42aa3744a5b95c08595abd4fa7ca2566a555c6a1..c3182e4f5ae694c52fccc1ee5848ca393d84015a 100644 (file)
--- a/README.md
+++ b/README.md
 
 ## Usage
 
+To convert all blog posts from markdown to html run the following command.
+This will also create an atom feed.
+
+```bash
+./md2html.sh
+```
+
 ## License
 
 This program is distributed under the terms of the MIT License.
diff --git a/blog.html b/blog.html
new file mode 100644 (file)
index 0000000..c93f0ca
--- /dev/null
+++ b/blog.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+  <title>krickl.dev</title>
+  <meta name="description" content="Lukas Krickl's personal page">
+  <meta name="keywords"
+    content="C, programming, lua, games, engine-dev, game-dev, indie, foss, open-source, git, linux">
+  <meta name="author" content="Lukas Krickl">
+  <meta charset="utf-8" />
+</head>
+
+<body>
+  <h1>krickl.dev</h1>
+  
+  <article>
+    <h2>Posts</h2>
+    <ul>
+      <li><a href="./blog/2025-06-22-hello-blog.html">2025-06-22 Hello Blog</a></li>
+    </ul>
+  </article>
+
+  <a href="./contact.html" >Contact</a>
+</body>
+
+</html>
diff --git a/blog/2025-06-22-hello-blog.md b/blog/2025-06-22-hello-blog.md
new file mode 100644 (file)
index 0000000..f52fb60
--- /dev/null
@@ -0,0 +1,11 @@
+# Hello Blog
+
+## 2025-06-22
+
+This is my first post on my new blog.
+The blog engine itself is rather simple. I use pandoc to convert markdown files to basic html.
+I also generate a simple atom feed with all entries.
+
+This blog will soon serve as a devlog for my gameboy game!
+
+Hope to be posting more soon :)
diff --git a/contact.html b/contact.html
new file mode 100644 (file)
index 0000000..65beeb0
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+  <h1>Contact</h1>
+  <ul>
+    <li>Lukas Krickl</a>
+    <li>email: <a href="mailto:lukas@krickl.dev">lukas@krickl.dev</a></li>
+    <li>mastodon: <a href="https://social.linux.pizza/deck/@unlink2">@unlink2@social.linux.pizza</a></li>
+  </ul>
+</body>
+
+</html>
index e7288121fe0022c2bfab1dcce9e348276127f70b..b1e674439b6464fbba2279d5b842b145942173a9 100644 (file)
   <h1>krickl.dev</h1>
 
   <article>
-    <h2><a href="https://git.krickl.dev/?p=ulas/.git;a=tree">ulas</a></h2>
+    <h2><a href="./blog.html">Blog</a></h2>
+  </article>
+
+  <article>
+    <h2>Projects</h2>
+
+    <h3><a href="https://git.krickl.dev/?p=ulas/.git;a=tree">ulas</a></h3>
     <p>
       Ulas is a assembler for the sm83 cpu.
       It currently supports direct assembly without a linking step and will in the future also offer 
       a disassembler as well as a debugger interface. 
     </p>
-  </article>
 
-  <article>
-    <h2><a href="https://git.krickl.dev/?p=gbrg/.git;a=summary">gbrg</a></h2>
+    <h3><a href="https://git.krickl.dev/?p=gbrg/.git;a=summary">gbrg</a></h3>
     <p>
       Gbrg is a turn-based rpg for the gameboy written in ulas.
       It serves as a demo project for the assembler.
     </p>
   </article>
 
+  
+  <article>
+    <h2>Links</h2>
+    <ul>
+      <li><a href="https://git.krickl.dev">git</a></li>
+      <li><a href="https://codeberg.org/unlink2">codeberg</a></li>
+      <li><a href="gemini://krickl.dev">unlink2's capsule</a></li>
+    </ul>
+  </article>
 
-  <h2>Links</h2>
-  <ul>
-    <li><a href="https://git.krickl.dev">git</a></li>
-    <li><a href="https://codeberg.org/unlink2">codeberg</a></li>
-    <li><a href="gemini://krickl.dev">unlink2's capsule</a></li>
-  </ul>
-  <h2>Contact</h2>
-  <ul>
-    <li>email: <a href="mailto:lukas@krickl.dev">lukas@krickl.dev</a></li>
-    <li>mastodon: <a href="https://social.linux.pizza/deck/@unlink2">@unlink2@social.linux.pizza</a></li>
-  </ul>
+  <a href="./contact.html" >Contact</a>
 </body>
 
 </html>
diff --git a/md2html.sh b/md2html.sh
new file mode 100755 (executable)
index 0000000..0173b92
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+set -e
+
+# This script takes all pages in ./blog/*.md and converts
+# it to markdown using pandoc
+# It also creates an atom feed
+
+# convert blog to html
+
+cd ./blog
+for f in *.md; do
+  BASENAME=$(basename $f ".md")
+  pandoc -f markdown $f > "./$BASENAME.html" 
+done
+
+# create atom feed
+
+write_atom() {
+  printf "$1\n" >> ./atom.xml 
+}
+
+printf '' > ./atom.xml 
+
+DATE=$(date)
+URL="https://krickl.dev"
+AUTHOR="Lukas Krickl"
+
+write_atom '<?xml version="1.0" encoding="utf-8"?>'
+write_atom '<feed xmlns="http://www.w3.org/2005/Atom">'
+
+write_atom "  <title>$URL</title>"
+write_atom "  <link href="$URL/blog/atom.xml" rel="self" />"
+write_atom "  <link href="$URL" />"
+write_atom "  <id>$URL</id>"
+write_atom "  <updated>$DATE</updated>"
+for f in *.md; do
+  BASENAME=$(basename $f ".md")
+  UPDATED=$(date -r $f)
+  write_atom '    <entry>'
+  write_atom "      <id>$URL/blog/$BASENAME.html</id>"
+  write_atom "      <link rel=\"alternate\" href=\"/blog/$BASENAME.html\" />"
+  write_atom "      <title>$BASENAME</title>"
+  write_atom "      <author><name>$AUTHOR</name></author>"
+  write_atom "      <updated>$UPDATED</updated>"
+  write_atom '    </entry>'
+done
+
+write_atom '</feed>'