What would be a sensible way to implement a regularly changing bit on a Hugo front page, e.g. “post of the day”? It would have a randomly chosen post, perhaps within a certain tag and by a certain author - or show a post from a pre-defined list. I’m running Github-Netlify, so presumably I could use Github actions to trigger a daily build. Or is there a sensible javascript solution? Curious what you would suggest.
I would do something ala:
{{ $randomPost := index (site.RegularPages | shuffle ) 0 }}
You can replace site.RegularPage
with a where
clause if you want something specific.
7 Likes