Blog posts linked to each other

2011-12-04 20:58:00

Earlier this morning I pushed out my latest updates and found a few problems. Today I went about fixing things, and added another feature to make blog posts have Previous and Next post links at the bottom of the page.

When I pushed my changes I noticed that my blog posts no longer showed up in the order I expected them to. This is because I was using the `stat` of the post files to order them, and it slipped by me that using version control means the mtime isn't a reliable mechanism for determining post order unless I build an elaborate scheme to record my original file mtimes and re-touch the files after checking them out from Fossil, and really scratch that!

So after making some hotfixes I spent some more of today scrapping the mtime mechanism, in favor of reading content from within the posts themselves. On single-post days I should only need YYYY-MM-DD, and on multi-post days I'll also need time information to help disambiguate and order correctly.

The method of adding Prev/Next links is something I'd like to clean up, it's a bit kludgy and was hacked in and means I now need to iterate over my list of blog post files and open them twice for edits in order to do the bi-directional linking. I might ease the process and open for edits once if I do something else, maybe store post file metadata into a SQLite DB. I'll revisit this later, I think next up is either working on the calendar content or attempting to fetch my Twitter feed and display that content in the blog as well.

Prev << Blog posts by fileNow with RSS >> Next

Explore

Subscribe

RSS iconSite-wide RSS

RSS iconPersonal blog

RSS iconWebsite posts

RSS iconTransportation posts

Contact

teeheehee on Twitter@teeheehee@teeheehee at GMail

Follow me on App.net

Subscribe

RSS iconBlog feed

Calendar

Todo...

Twitter feed

Todo...