Game-in-a-post: Yz (or, on post-specific JS/CSS requirements in Hugo)


I’ve been meaning to figure out a way to include custom JS/CSS with posts in Hugo, and I think I nailed it down. My only real issue was variable scoping related to the paginator. I can now include two arrays in the frontmatter: requireCSS and/or requireJS, and they will appropriately load on the homepage and the post page. Taxonomy pages, I still need to think about how to handle, but I’m demoing this anyway because, well, it’s fun.


this post is part of the series, game-in-a-post:
  1. Yz (or, on post-specific JS/CSS requirements in Hugo)
  2. Dim Corridor
  3. Sid Sackson's Solitaire dice
  4. Rolling Market