🌱 Seedling changelog

Adding statistics to 11ty

planted on in: Blogging and 11ty.
~319 words, about a 2 min read.

Last month I stumbled upon Tim Hårek Andreassen's blog stats page and thought it cool enough to open issue #148 as a reminder to add the same to PhotoGabble.

Tim's blog uses the Zola static site generator and therefore made use of the filters built into Zola for discovering the following statistics:

  • Total words written
  • Total posts published
  • Average words per post
  • First Post (linked)
  • Longest Post (linked) with word count
  • Number of posts, total words and average words per post by year
  • Top Tags by posts

I have already written code for "Top Tags" the output of which can be seen at the bottom of the main Photogabble Archive page and I wrote @photogabble/eleventy-plugin-word-stats: a word stats plugin for Eleventy (for more details read A 11ty Reading Time Plugin Quest) which can help with obtaining the other stats.

In order to obtain the other statistics I wrote a filter than reduced an input collection to the following data structure:

interface Data{
totalWords: number;
totalItems: number;
firstItem?: Object;
longestItem: {
wordCount: number;
item?: Object;
byYear: Map<number, DataByYear>

interface DataByYear {
year: number;
totalWords: number;
totalItems: number;

This filter didn't actually end up directly using @photogabble/eleventy-plugin-word-stats for obtaining word counts, but it did use the reading-time library it depends upon so that my statistics all came from the same source.

You can see the live output at /stats.

Page History

This page was first added to the repository on January 18, 2023 in commit 469fc99e and has since been amended 4 times. View the source on GitHub.

  1. feat(#306): move changelog posts to /changelog/* permalink
  2. refactor(#304): move files into src folder
  3. chore: add missing tags
  4. feat(#148): complete "change log" post
  5. chore(#148): begin writing "change log" post