lazyblog

Created: — modified: — tags: bash javascript

a static blog generator which tries to do as little as possible on the server side

Few years ago I switched my website to bashblog and was very happy. But with time, as number of posts was growing, bashblog began being slower and slower, especially in "edit" mode. Reason, as I think, was 'all_posts' page, which was regenerated every time anew, and many tag pages (many tags on each page times many pages on each tag equals long rebuilding time), and every single time script had to open each post page to read title (and maybe some text) from it. Not very good.

So I decided to try a different architecture:

That's how lazyblog was born.

Result? bash script speed is pretty impressive - it processes each file in almost no time (the longest part is actually markdown processor). Client-side performance also tries to be as fast as possible, especially during page load (expensive DOM operations and rendering of below-the-fold content is delayed).

Actually, the hardest-to-optimize part was extracting data (post titles and tags) from the actual webpage - turns out, the fastest way was just to create many special <div> tags and extract data from them. Other ways (including using regular expressions) are left in script.js.bak in repository.

There is also a bb-import.sh script which imports posts from a bashblog installation, assigning proper dates, tags, title, and sometimes intro text (although manual correction sometimes is needed).

Github link: https://github.com/Lex-2008/lazyblog