CMS: Random Image + Links

Hello @upssjw

Since you just posted a similar project, I wanted to ask whether you might have an idea how I can also assign a corresponding link to each image in the Markdown frontmatter when outputting random images.

The random image output itself is working fine so far. What I’m struggling with is correctly outputting the matching link for the selected image.

So far, I haven’t been able to reliably create a Twig syntax that also outputs the correct link for the corresponding image.

Do you perhaps have an idea how this could work? I’ve already adapted your example project the way I thought it should work.


@Pegasus

I created a very small custom component, think this works ok, you can try, add more images, delete the span bit to not show link leave image as link only.
pulling image, url and alt from md file

project in next post

added back the normal twig into image and background, as well as custom component version - added the alt to the image

Project use below

Now works in latest version of Elements

This does not work in the current version of Elements, only works in previous version

Elements should be updated today

pull in random image, alt, address and shortened word for link, all from frontmatter

project - elementsapp://downloadDocument/fpIY0a2RsNeg

Thanks, Steve.

That’s actually as far as I had already gotten. What I’m really trying to find is a way to solve this using the IMAGE component.

The random output of the image itself works without any problems. What I also want, though, is the correct matching URL for the image that gets displayed.

That’s the point where I’m stuck and can’t seem to get any further.