I just finished setting up the pages for tags, streams, and series. Along the way, I was pleased to find Eleventy’s support was much better than I thought, but also disappointed by a few major oversights. I wanted to set up a tag page using this front matter:

---
pagination:
  data: collections.postTags
  size: 1
  alias: postTag
---

I also needed to set up a ‘Dynamic Permalink’ to put the pages in the right place, but because I’m using Pug, dynamic permalinks are not recommended, so I had turned them off in my Eleventy config. I thought I would set up some clever Computed Data instead:

const slug = require("slug");

module.exports = {
  eleventyComputed: {
    permalink: ({ postTag }) => postTag && `/tags/${slug(postTag)}/index.html`,
  },
};

With this configuration, the pages were generated correctly and logging showed the right values, but instead of a file like dist/tags/responsive-design/index.html, I would end up with dist/tags/responsive-design/19/index.html, where 19 was the page number.

After I had combed through the docs and my code to verify that I hadn’t got something wrong, I asked on the Eleventy Discord channel without any success. Then I turned to my old friend: the source code. What I found there was that if Eleventy encounters a blank permalink value, it will add a subdirectory, and it will only look up that value in the front matter, not using the Data Cascade. Next, I found that turning off dynamic permalinks in the Eleventy configuration would force it to stay off. There is no way to turn it on just for specific files, even if you put it in the front matter and not computed data, or in an eleventyComputed.js data file. Therefore, the only option was to turn on dynamic permalinks for the project as a whole then turn them off wherever they caused trouble.

Still, all that investigation was worth it to get to the point where we now have pages for streams, pages for tags, and—my favourite despite a small problem with the numbers—series pages, which automatically includes multi-part thoughts. Everything is linked appropriately as well. I decided not to have any general next or previous entry links; instead, only series links are placed on entry pages, and the link to the homepage now includes an anchor that will bring you to that spot in the list. This may be extremely clever or extremely dumb. Time will tell.

That’s a lot of major issues resolved. The next big one is commenting. I have no idea whether or how I’ll tackle that. Then it’s just a matter of going back and revising all my writing, enhancing the code blocks, making the spacing and sizing consistent across the site, and general tweaks & fixes. Maybe I’ll even remove the notice about the site being built in the open now. And set up the email account.

Next in series: (#6 in Colophon: Finding A Place For My Head)