Jacob Kaplan-Moss

Tag: templates

TIL: Recursion in Hugo Templates March 6th, 2024

Turns out recursion is possible in Hugo templates by define-ing blocks and then “calling” them with template. (I had thought define was only for overriding blocks from parent templates, like Django). The use case was that I wanted to render a nested file tree, e.g. - dir/ - file1 - file2 - dir2/ - file3 - dir3/ - file4 - file5 And so here’s a slimmed down version of what I figured out:…

Seasoning Templates July 19th, 2007

I’m a food geek. I spend my free time contemplating recipes. I bore my friends by talking about the Maillard reaction and annoy them by saying things like, “did you know that cheesecakes aren’t actually cakes at all?” I wonder about the techniques for replacing chemical with organic leavening and vice versa. I watch the Food Network, and Alton Brown is my hero. I cook a lot, of course, and I’ve gotten pretty good at it.…