And You Can Quote Me
The last few days I’ve been in a knife fight with Hugo.
I wanted to implement a randomized quote feature on the front page. Something like:
**Quote of the Day**
Over every mountain is a path, although it may not be seen from the valley.
~Theodore Roethke
I tried a few things, readFile, a readfile shortcode, dynamic data files in JSON, and so on. Nothing worked reliably with Hugo server.
So instead, I’ve implemented what I want with a Server Side Include. I turned on SSI in my webserver configuration, and I’ve included the SSI directive in home.md. The directive is:
<!--#include file="quote.html" -->
which includes the file into the rendered output from the server.
I have a simple perl script there to pull quotes out of a quote file and do some simple markup. Cron updates it every night.
The quotes themselves are from a collection of quotes I took with me from my last job where the CISO used to send out a daily quote email. I copied them all, well, all the ones I cared about anyway. So - thanks Kerry! Much appreciated.
– Jim B.