Hugo |> Hugo Custom Shortcodes



I want to create a shortcode to convert

{{< CUSTOM_TAG "https://stackoverflow.com/questions/25589113/how-to-select-a-single-field-for-all-documents-in-a-mongodb-collection" >}}

to

[https://stackoverflow.com/questions/25589113/how-to-select-a-single-field-for-all-documents-in-a-mongodb-collection](https://stackoverflow.com/questions/25589113/how-to-select-a-single-field-for-all-documents-in-a-mongodb-collection)

Solution:

mkdir layouts/shortcodes
vim layouts/shortcodes/ref.html
ref.html

<ul>
  {{ range .Params }}
  <li><a href="{{ . }}">{{ . }}</a></li>
  {{ end }}
</ul>

PS:

We can use shortcode figure to set image width and/or height.

{{< figure src="your-image-link" width=200 height=200 title="your-image" >}}

References: