AubsTalk

Eleventy Shenanigans

tags:

Welp. I was so excited for Eleventy.

I've been working tirelessly to construct a new, more flexible build system for my Left Is Best project. Some of the features I was particularly keen on include:

  1. Improved desktop+mobile responsive appearance
  2. User-settable theming for text content, including colors, text size, text width, line height, font, etc.
  3. Scalable backend structure to permit easily-modifiable site-wide changes
  4. Easier additions of new content
  5. Accessibility features built in
  6. Easy navigation
  7. User-set bookmarks to return to content later

Most of these are in direct response to gripes I've had with the Marxists Internet Archive, and as part of this switch, I'm working on adding several new texts that, while not unavailable or even less available, per se, are still important texts worth reading (the communist classics), but are annoying to read on MIA.

Visual demonstration of upcoming features for left is best

You can see here a couple of these features, like the breadcrumbs following the structure of the site, stuck to the top of the scrolled content. You'll also see a nice small unobtrusive progress bar at the very top, which follows your progress through the page.

I was just getting the hang of the new system, when I quite suddenly ran into an issue. While adding the EleventyNavigation settings to the frontmatter, so that menus and navigation could be automatically generated for pages:

---
layout: "toc.njk"
permalink: "/author/haywood/rtnl/"
title: "The Road to Negro Liberation"
eleventyNavigation:
  key: haywood_rtnl
  parent: haywood
  title: "Negro Liberation"
---

So for each chapter below the table-of-contents level, there would be a subsequent eleventyNavigation frontmatter, with its parent being the haywood_rtnl key, right?

This works.

Or at least, it's supposed to work.

The EleventyNavigation plugin is designed to work with infinite depth navigation. The real problem, however, is that as soon as the total number of chapters included in my overall site exceeded around 200, the build system threw an error, an actual stack overflow. the JSON objects generated through the navigation system (which in turn is handled by Nunjucks), had so many references to other data and portions of the site, that it was running circles upon circles, causing the recursion to explode and utterly fail.

Worse yet, this is not simply because of the way I've coded my frontmatter; I've dug into GitHub issues for several projects now, and this is a known problem, with the given solution being "organize your site a different way" or "don't use this system then", pretty much.

So far, I've continued working, instead using tags for the chapters that reference the navigation key for their parent (the book of which they are a member), and wrote some javascript to trick each page's dynamic generation to behave as though the chapters are part of the navigatory structure.

This is not sustainable. I need something that is actually, genuinely scalable, and lets me handle the structure of my site on my own terms, without having to do every part of the static site build process by hand.

Eleventy is so good, and may work well for blogs or smaller sites, but I do need something that permits a level of content scalability that may be outside of its scope.

I've been looking at Astro, which seems to be much better for my purposes, but it will take quite a bit more work to whip it into shape for my specific purpose. The ultimate benefit will be that I should be able to expand effectively as large as I want, in the end, with as many books and articles as I can stomach, with a much quicker deployment speed. But, of course, this will mean rejiggering a shitload of the things I've already gotten to work. :(

Sigh. I don't want to get this system up and running, only to have to then restart the process from scratch. The only upside is I've already broken down my site's content into its component parts, and beside the javascript/astro logic piecing everything back together, most of that would just be simple adaptation of those existing parts. I guess we'll see.