Hugo Footnote for the 100 Days to Offload Challenge
Yesterday I posted my 25th blog post for the #100DaysToOffload. That’s 25% of the challenge.
If it wasn’t clear by the post Showing GitHub Stars With Static Site Generator Hugo, I use Hugo for this site.
All this time, I was manually adding a footnote to each of the blog posts:
This post is {n}th of my #100DaysToOffload challenge. Want to get involved? Find out more at 100daystooffload.com.
Figuring out what {n}
is for each blog post wasn’t fun.
I replaced that with a simple snippet of Hugo template code:
|
|
This template, in the context of a blog post, checks to see if the blog post has the 100DaysToOffload tag. If it does, we look at all the blog posts with the same tag and determine the index of the current blog post among the list.
The template uses the humanize
function to display the n-th ordinal.
A preview of what the end result looks like should be just below.
This post is 26th of my #100DaysToOffload challenge. Want to get involved? Find out more at 100daystooffload.com.
comments powered by Disqus