Updated md2html generator main origin/HEAD origin/main
authorLukas Krickl <lukas@krickl.dev>
Sun, 29 Jun 2025 07:06:58 +0000 (09:06 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 29 Jun 2025 07:06:58 +0000 (09:06 +0200)
README.md
blog/2025-06-22-hello-blog.md
blog/2025-06-27-gbrg-movement.md
md2html.sh

index 1bf1c1441758904b3f1ef8c56029d41afe6ee88f..e1baa5db247da9c502be7e42599863a4f5251fe5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -33,6 +33,15 @@ Currently the webserver expects those binaries to be there.
 Images are stored in `images/`.
 They are not part of the repository but posts may reference them.
 
+### Posts
+
+All blog posts should have the following format:
+
+File name: `yyyy-mm-dd-summary-of-post.md`
+
+Line 1: Title of post as h1
+Line 2: Date of post (yyyy-mm-dd) as h2
+
 ## License
 
 This program is distributed under the terms of the MIT License.
index f52fb60212fde3fa9df9004d2342cab30e3d15f8..bde77e34dd96dce6317c949581cad62d4d6edce8 100644 (file)
@@ -1,5 +1,4 @@
 # Hello Blog
-
 ## 2025-06-22
 
 This is my first post on my new blog.
index e8cbbf1ee81245bd99590c2d74f1079eacfe5b26..00872237e3c6f0178a96718d5e6141493287a986 100644 (file)
@@ -1,5 +1,4 @@
 # gbrg movement
-
 ## 2025-06-27
 
 This is my first post about gbrg, the gameboy rpg I am working on right now.
index d4bdc684912f989d57f234d73539e926e7a45fa2..778943531456b8458d5a57c48405b40e94558821 100755 (executable)
@@ -28,6 +28,7 @@ printf '' > ./atom.xml
 DATE=$(date)
 URL="https://krickl.dev"
 AUTHOR="Lukas Krickl"
+EMAIL="lukas@krickl.dev"
 
 write_atom '<?xml version="1.0" encoding="utf-8"?>'
 write_atom '<feed xmlns="http://www.w3.org/2005/Atom">'
@@ -40,11 +41,15 @@ write_atom "  <updated>$DATE</updated>"
 for f in *.md; do
   BASENAME=$(basename $f ".md")
   UPDATED=$(date -r $f)
+  CONTENT=$(cat "$f")
+  TITLE=$(cat "$f" | head -n 1)
+
   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 "      <title type=\"text\">$TITLE</title>"
+  write_atom "      <content type=\"text\">$CONTENT</content>"
+  write_atom "      <author><name>$AUTHOR</name><email>$EMAIL</email></author>"
   write_atom "      <updated>$UPDATED</updated>"
   write_atom '    </entry>'
 done