Help with image path

With the following structure and front matter, I’m trying to reference the path of each image.

Content
   |--- blog
         |--- hugo
               |--- index.md // images = ["img1.png", "img2.png"]
               |--- img1.png
               |--- img2.png

In blog/single.html, I’m doing this:

{{apply .Params.images "absURL" "." | jsonify}}

Which gives: ["http://localhost:1313/img1.png", "http://localhost:1313/img2.png"]

Is there a way to add append the path, blog/hugo to each image so that you get:

["http://localhost:1313/blog/hugo/img1.png", "http://localhost:1313/blog/hugoi/img2.png"]

Get the image as a page resource then use its .Permalink

1 Like