4 ms·
Yep I recently did exactly this for my personal site as well (including initially writing HTML by hand), but instead of lisp I wrote a ~100 line python script[0
by umvi 5y ago
Yep I recently did exactly this for my personal site as well (including initially writing HTML by hand), but instead of lisp I wrote a ~100 line python script[0] so that I could write future content in Markdown instead of HTML. Yes I'm aware of Jekyll and Hugo and such, but even those were too complex for my personal site. It only took about an hour of my time to write it, and now anytime I push markdown changes to my git repository, GitHub Actions runs the markdown through the python script and generates the site which is hosted on GitHub pages.
[0] For the curious - https://gist.github.com/RPGillespie6/b133854b8ebf5a983cf32c26d684cff3 https://gist.github.com/RPGillespie6/b133854b8ebf5a983cf32c2...
- Shared404 5y agoI'll jump on this bandwagon too. I did it in Rust, because I wanted to learn Rust. It just takes a directory structure with markdown files, and converts each file to HTML while adding a header and footer. I use it on a few sites now, and honestly I should redo the code but it works conveniently and I have other stuff to do. Oh, and my stack is nginx on Alpine currently. Edit: Code is here: https://git.sr.ht/~evan-hoose/SSSSS https://git.sr.ht/~evan-hoose/SSSSS It really is not great code. It even shells out to markdown to do the rendering - bad for all sorts of obvious reasons. (but the right choice for my use case). If you want to use it, be my guest. Just know that it's bad and ugly and you could write it better yourself in not very long.
- qchris 5y agoJumping on the bandwagon of the guy that jumped on the bandwagon, because you mentioned potentially re-doing your own code at some point so might be interested: my personal site [0] looks very much like this (and is also written in Rust), but uses the comrak [1] crate to convert blog posts from Markdown to HTML on the fly before formatting with the header/footer theme. Using comrak lets you write in-line HTML (so you're not stuck with only Markdown syntax if you want to do something fancier like code blocks or <math></math>), and the whole site ends up <150 LoC, including route definitions. It handled the one potential HN hug-of-death event I've had without issues while running on the smallest DO droplet offered, and has basically been issue-free since I got it up and running. [0] https://github.com/quietlychris/site https://github.com/quietlychris/site [1] https://github.com/kivikakk/comrak https://github.com/kivikakk/comrak
- Shared404 5y agoLooks interesting, thanks! I may very well do something similar at some point, though I've also thought about using it as an excuse to redo whenever I want to learn $LANGUAGE, or writing a markdown (or subset of markdown) interpreter at some point. Definitely going to read through the code more closely as well - I've been meaning to find some short and well written Rust.
- lmm 5y ago> instead of lisp I wrote a ~100 line python script[0] so that I could write future content in Markdown instead of HTML. Yes I'm aware of Jekyll and Hugo and such, but even those were too complex for my personal site. Why does this kind of "complex" matter? By all means code if you enjoy it, but it sounds like minutes of coding saved you seconds of installing something that already exists, and got you a setup that is less standard and so harder to maintain.
- sseagull 5y agoI have found lots of static site generators more focused on blogs than a more traditional personal website. While they can be used for non-blog sites (I use Hugo for my own site), I can see how they can be daunting when first approaching them and seeing nothing but blogging examples and templates.
- keerthiko 5y ago> Why does this kind of "complex" matter? The real "complexity" that matters, as someone who has used most modern static site generators and front-end js frameworks, is in not knowing how or what broke, and how to fix it, when inevitably something breaks. E.g: with jekyll if you develop or modify content on a windows box, test locally, and then push to GH Pages, but Pages builds the site using unix, and some ruby gem or jekyll plugin doesn't work consistently across them, and it takes a good bit of experience and googling around the errors to find a fix or a workaround. If you essentially made your own static site generator, at least you would know what went wrong and come up with the straightest line to the resolution (even if that's just modifying the build output by hand in an extreme case).
- lmm 5y agoIf we compare like with like and assume that in both cases you're developing locally on windows and running on GH Pages, something established like Jekyll has a much better chance of working consistently on those different OSes than a hand-written script, IME.
- 5y ago