How to make main page with untrancated full text posts with images stored in posts folders

I use theme: https://github.com/zyro/hyde-x. It is outdated but i made few changes and it works just fine.
I store images bundled in the content posts folders. The typical post structure is like this:

content/
	post/
		examplepost/
			index.md
			image1.png
			image2.png

In markdown I reference the images just by filename: ![](image1.png)
On pages of single posts, that works. The images are linked in HTML with relative URLs and are shown correctly.

But when I try to make main page with list of full untruncated posts, the images are still linked with in HTML with relative URLs and are not shown.

I tried changing “canonifyURLs” and “uglyURLs” params, but they seem to have no effect on the issue.

There are a few old topics here on similar issues, but they mainly suggest solutions to move images from post folders to some centralized folder, which is really not very convenient and discards bundle feature.

Is there any solution to this issue? I.e. is there a way to force absolute URLs for images stored in posts folders and referenced in markdown just by filename?

You could use a shortcode. Something like

![]({{< img "image1.png" >}})

Then in your img shortcode definition: (1) get the image page resource for the image passed in, and (2) return the permalink of the image page resource.

2 Likes