logoalt Hacker News

A static site generator written in POSIX shell

55 pointsby todsacerdotilast Tuesday at 10:56 AM28 commentsview on HN

Comments

eemiltoday at 2:22 PM

Bit of an unknown feature, but tree can output HTML. I've used tree -H to generate directory listings more than once.

tasukitoday at 9:23 AM

Yes, in shell, but requiring 'comrak', whatever that is. I also generate[0] html[1] from markdown for my vimwiki.

[0]: https://github.com/tasuki/vitwiki/blob/master/build.sh [1]: https://wiki.tasuki.org/

show 1 reply
p4bl0today at 11:00 AM

I did something similar a (very) long time ago (15 years back!), a static site generator and blog engine entirely coded in sh (yes, not even Bash) + coreutils. The idea was to use those scripts in git hooks, as they provide a template engine that allows to use the Git repository as a storage backend and publishing method, both for posts content (as file or as commit bodies) and for meta data about posts (author, date, etc). It was fun to build and got a few dozen users at the time, some even contributed small bugfixes and features :).

The README is here: https://p4bl0.net/shebang/fugitive-readme.html

aviantoday at 8:56 AM

My first blog was made with NanoBlogger, which was what you would call a static site generator today. It's made in Bash.

I remember setting up a few of these back in the day.

https://nanoblogger.sourceforge.net/

show 1 reply
msephtontoday at 8:56 AM

This is fun. I do love a good bit of shell scripting. Also makes me want to make my own little ssg in whatever way I see fit.

show 1 reply
mrwhtoday at 6:50 AM

Love it! My personal sites tend to start hand-written, evolve into a bash script, occasionally advance into python, but mostly just stay in bash, because it's convenient, doesn't need to please anyone else (nor would it!), and is already built for text processing into files. (I write a lot of scrappy shell scripts for my job too. I guess I should start asking an AI to generate whatever I want directly instead. Cobbling together a script is more fun though...)

vbezhenartoday at 8:31 AM

I wonder what would be a good way to generate a website with minimal software installations, for example in standard github runner image. This example uses comrak tool to process markdown into HTML.

I've come up with using Java and XSLT. Java is installed in Github Runner image and there's built-in XSLT support in Java standard library. You can write HTML and use XSLT to add header, footer and do other processings if necessary.

So basically I want to generate a website in github runner without accessing network to install something else.

I guess one could just `cat header.html content.html footer.html` but that requires a lot of tiny things like extracting title from content and inserting it into header, etc. Nothing that lots of greps and seds couldn't handle, of course...

show 5 replies
jimnotgymtoday at 12:48 PM

Slight tangent, what is a good markdown editor for Linux? I need spell check and a preview at least.

show 1 reply
austinjptoday at 10:49 AM

Lovely. It's gratifying to see this broadly matches my own personal SSG: bash, find, sed, envsubst, and pandoc rather than comrak.

Piratytoday at 9:32 AM

i write in markdown, use lowdown + make to build html, push the html to a branch that my hoster serves from : https://piraty.dev/

riedeltoday at 7:35 AM

The title seems to be a bit misleading IMHO because it does not really only use `sh` but heavily `sed` it seems, which is a whole programming language well suited for templating. I've in the old days written a Macromedia Dreamweaver compatible template engine using such a scheme, which I personally used quite a long time actually without Dreamweaver because this WordPress madness was even a thing.

lombasihirtoday at 8:04 AM

why not perl?

show 2 replies
paseantetoday at 7:01 AM

What is wrong with people.

show 3 replies