Ryan Keleti

2020-07-25 › site

So I redid my website again (big surprise) but I think I'm okay with it for now. This time I decided I wanted another static site generator, but the ones out there either had a lot of auto configuration or features I didn't really need. So I figured I'd make my own, and add features myself as I need them. One place I got inspiration for this is the Rust blog.

Technically I didn't make a static site generator from scratch, but took some available pieces out there and put em together. The main component is Tera. This is Jinja2-like templating engine, which allows me to generate pages using blocks and variables. For example, I first make a base.html file, which has all the usual HTML stuff, like

<!doctype html>
...


etc. Then inside this base.html, I can put blocks such as

<main>
{% block main %}{% endblock main %}
</main>


Now instead of copy-pasting this template, to make a page with main filled in, I can do

{% extends "base.html" %}

{% block main %}
Content
{% endblock main %}


This is kind of similar to the templating I did before with Racket, but I find this a lot easier to maintain.

On top of this, I decided to make my own blog engine of sorts, and this post is from that. Using pulldown-cmark, I can pass in markdown files and have them parsed to HTML, and put in the main block using Tera templates. Then I added a tag system, which allows posts to be placed in categories/tags (note that a post can have more than one tag). This post is in the site tag.

Some todos might be to add syntax highlighting to code blocks (edit: did a bit of this) and maybe an RSS and/or Atom feed (edit: added an RSS feed, available here).

I also moved the blog site (with redirects) from blog.ryankeleti.com to ryankeleti.com/blog/, as I currently prefer that a bit. I might put out the source for this sometime, although I can't claim much originality. That's pretty much it for now!