A Stats Page

Fun with blog data!

I鈥檇 like to briefly draw your attention to a new page on my site: the stats page!

This is a new thing I鈥檝e added simply to see if I can. It鈥檚 done using a Hexo generator which compiles all of the stats about the site then passes them into a template to be nicely rendered. Hexo generators essentially can render anything to a file (mostly JSON, which is how the Lunr stuff works), but can also render a template. It鈥檚 all done at build-time, too.

Now you can see how much I鈥檝e written here (over 100k words at this time!) and how often I post (not enough). I鈥檓 hoping that having these stats around will encourage me to write more posts and to keep them small. The average post is over 1k words which seems way to large.


Figuring out that Hexo generator was a pain. The documentation does a great job of letting you know you can render templates from a generator and shows examples of doing so. What they don鈥檛 show is how to access the value of the return object鈥檚 data property in the template. What I learned, from digging around the source code of the Stir Trek site (of course), is that the value of that data property is exposed as the page object within the template.

Hexo鈥檚 documentation leaves a lot to be desired.


The charts are built using Chartist. It鈥檚 a nice-enough plugin for this sort of thing. I like the use of musical intervals to denote various aspect ratios, though that鈥檚 not a very intuitive approach. Overall it鈥檚 a fine library, though I鈥檓 mostly using it because of how small it is. If I wanted more customization then I would look elsewhere.


Photo by Luke Chesser on Unsplash.