iNaturalist shortcode for Hugo

For my recent post about the Alta Via 1, I wanted to integrate iNaturalist observations. To make this easier, I made a Hugo shortcode that calls the iNaturalist API and renders an observation in detail automatically.

This turns

{{< inat "https://www.inaturalist.org/observations/50674264" >}}

into

Mountain Bluebird (Sialia currucoides)
2020/06/16 8:41 AM PDT
Trinity County, CA, USA
Aves
1 IDs

The source code for this shortcode is below. It can be placed in /layouts/shortcodes/.

To look nice, it will also require some CSS integration into the theme that is used. A sample set of CSS rules is here: