I liked to begin posts on the previous incarnation of this blog with a quotation and I see no reason why I shouldn’t continue the practice. For one thing, I quite enjoy researching them – occasionally stumbling over misattribution and misunderstanding when attempting to verify.
For example, Gandhi’s purported “Be the Change”, Michaleangelo’s “Ancaro Imparo” and the history of considering oneself a Citizen of the World – a phrase that was thrust into the headlines most recently when Theresa May put forward her own unpleasant interpretation.
Anyway, in order to avoid repetition in my Markdown source files, this use case seemed to be a prime candidate for writing my first custom Hugo shortcode.
Consequently, I’ve added this to the top of my blog post archetype:
Which makes use of the corresponding shortcode template:
- Passing the author through the
safeHTMLfunction lets me add arbitrary markup, should I wish to include a citation for example.
With some styling applied, I get a nice-looking introduction for each post with minimal effort and a single file to change should I ever feel the need to update the layout.