DEV Community

Chris Connelly
Chris Connelly

Posted on

2

Creating custom shortcodes in hugo

layouts/shortcodes/placehold.html

{{ $width := .Get 0 }}
{{ $height := .Get 1 }}
<img src="https://placehold.it/{{$width}}x{{$height}}" alt="Placehold image"/>
Enter fullscreen mode Exit fullscreen mode

We can now call

{{placehold 250 250}}
Enter fullscreen mode Exit fullscreen mode

we end up with

Alt Text

have you built any cool custom shortcodes?

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more