Building my blog

Islam Abdalla

Software developer | Entrepreneur | Open source enthusiast
This site is about me, things I care about, thoughts, and random things.

Building my blog

2024-03-21 22:57

22:08 PM:

So I am writing this blog as I am building it and here's my thought process. I don't wanna build a database for it. I prefer to make simpler with Mardown files only. I am gonna see how it goes and once I hit the limitation of this approach I might change it to something more robust. This first blog is a test to see how it will work.

First things first. Markdown to HTML is simple enough. I am using commonmark-java for this.

The issue I need to figure out is where to store the meta data (like the title, last edited date, etc.)

22:18 PM:

Bingo! YAML Front Matter. Now let's see if commonmark-java handles front matter correctly. Might be easier just to run and see if it works.

22:32 PM:

Well, it looks quite good! However the font matter requires an extension (and a dependency).

Also images does not work (pasted Obsidian images I mean).

So! Instead of the font matter, can I just use json at the top and parse it manually? So each blog should have ```json at the top. I can split it, parse it, aaaaand that's it. Would it work?

23:21 PM:

Done! Added JSON at the top like this:

{
"slug": "building-my-blog",
"title": "Building my blog",
"lastEditedOn": "2024-03-21 22:57"
}

Parsed it, and displayed correctly. Now I need a way to make code blocks (like the above ) look nice.

23:24 PM:

Now, when someone navigates to a blog post link, we need to find the correct file and display it. Since I am not gonna use a db for now, I can cache the file names and their slugs in a list in the server for easier access.