Hugo pipe renders as text

I’m trying to test the image rendering functionality, but when I insert a hugo pipe in a post’s markdown file, it just displays the pipe as text.

For example, putting this in my post .md file:

test image:

{{ $image := Resources.Get "images/polaroid.png" }}

![polaroid test]($image)

Displays as this:

What am I doing wrong?

Related, is there a way to modify the markdown image tag (I assume via render-image.html) to always render images as webp? (either from the page bundle or from global assets)

Template code goes in template files.
Markdown goes in markdown files.

does that mean, in order to render unique images for a post, an individual template would need to be created for each post?

No.

With this content structure:

content/
└── posts/
    └── post-1/
        ├── a.jpg
        └── index.md

Your markdown should be:

![alt](a.jpg)
1 Like