Defining archive

Written by on

One of the things I’m making to help in explaining some of the concepts in my book is a bare-bones Jekyll theme called Alpha. Alpha provides the project structure for anyone to build their Jekyll theme off of. For this reason, Alpha tries to be as unopinionated design-wise so that folks can take their designs and quickly run with setting up a theme for Jekyll.

In building Alpha, I reached out to the folks who have signed up for my mailing list to see what sort of things would be helpful to them. I took a subset of requests and started building it into Alpha. One of which was to have a paginated archive page.

Without thinking over it much I thought it was a pretty reasonable request until I started building it out. At first I thought I could take the abandoned Jekyll paginate plugin and set it up in an archive.html file found in the root level of the project. But it turns out the plugin specifically looks for an index.html before it starts working. I tried nesting the archive page in a folder with an index.html files like archive/index.html which actually got the plugin to render, but the navigation wasn’t rendering correctly.

I decided to stop trying with Jekyll paginate seeing how it was abandoned anyways. I then wanted to see if there was an alternative plugin that might’ve been forked and picked up where Jekyll paginate left off. I found Jekyll paginate v2 and without too much fiddling it worked. I thought I was pretty close to getting this feature implemented but the plugin came with a few roadblocks.

The plugin generated all the paginated pages in the site.pages global variable so the generated menu that I had was rendering a lot more than I had wanted. In addition to generating the extra paginated pages in site.pages it was also adding .html to the end of each link. The only problem I had with this is, it didn’t obey my preference of permalinks without the .html that I had defined in the _config.yml file.

After tinkering with this for a few hours, I paused and started to think through why a paginated archive is even needed (something I should’ve done before even starting to implement a solution :disappointed:). I started to play around with what I had, and to me it felt more like a blog page then an archive. I did a quick search on the word archive and I found images of rows and rows of shelves with boxes and binders.

Based on the results of an earlier survey that I conducted, most of the folks interested in the book want to use Jekyll to build a personal site or for personal use. For this reason and the feedback from a GitHub issue led me to the decision to do away with pagination and go with an approach that is more inline with the images found for the word archive. Which is to just list every single post, in reverse chronological order and grouped by month. Like how my writings page looks like.

The benefits of this approach is, it aligns with the word archive, it is one less third party plugin to worry about, I don’t have to spend time trying to hack together a solution that I’m kind of ok with.

:wave: Hey hey, I'm Michael Lee! I really appreciate you taking the time to read this article.

If you'd more articles like this, you can get them by email.