Hi everybody!
Why would you want to create your own static site generator? Because then you won't have a hard time remembering how it works!
I used to use Jekyll for this small blog but it was a pain for me because i always forgot how it works. And everytime i wanted to use something fancy i had to google it and spent a lot of time just to find how to do some basic thing. So after few posts i migrated to plain HTML and CSS. I'm a web developer so i'm comfortable with these. The only thing i would miss were partials. With plain HTML and CSS one small change in sidebar means manual changes in all blog pages.
Well, let's see how hard could it be to write my own static site generator:
Turns out it takes only 19 lines in Ruby. And that's all! How it works? It takes all files by some glob matcher, finds lines with "ðNSERT <partial_path>" keyword in them and substitutes them with content from file in partial_path. Then it takes the modified content and outputs it in some other directory.
Do you need some other features? Custom variables support? 10 more lines. Automatic transformation of < and > into < and > for html code snippets? 5 more lines. The thing is, it's totally up to you and it's actually quite easy.
And other pros?
Which language is best for such thing? Well, the one you are most proficient with. Ruby, JS, Perl, Python, Bash... your choice. And that's yet another advantage.
Ok, that's all for now because to be happy, i just want partials from my own personal static site generator.
Have a good one, PÅemek