Adding Click Link To Custom Content Image

Topic summary

Summarized with AI on January 16. AI used: gpt-5.

Hello everyone,

My page url is: minisanitizersprayer.myshopify.com

My theme is: Narrative Theme.

I would like to add links to CUSTOM CONTENT images on my frontpage.

There should be added some code so that i can type in an URL address directly on the Shopify Editor.

I saw a different thread with this problem which was solved, but the code does not work on my theme.

Can anyone help me?

Thank you in advance!

Hi @Sadea , It has Gallery section so you can add links without need to code

Hi @Sadea

Yes you can follow @Dan-From-Ryviu 's answer or follow this if want to keep existing section.

  1. open custom-content.liquid section and find “type”: “image_picker” , it will look like this

  1. Now add below code just above " { “type”: “image_picker”, so it will look like below image
{
   "type": "url",
    "id": "img_link",
    "label": "Image link"
},

  1. Now find below line of code:

{% assign img_url = block.settings.image | img_url: ‘1x1’ | replace: ‘1x1.', '{width}x.’ %}

and add this code just below it

and add </a> after img tag close. it mean you have to add image tag withing this tag. it will look like below

image tag -codifyinfotech.PNG

Now save it and open theme editor where you can see Link box to add link image wise

Best regard

1 Like

@Jasoliya @Dan-From-Ryviu

I’m sorry, I didn’t see that it is not a gallery but rather a CUSTOM CONTENT section with images:

Yes, then follow my given instruction.

Hi @Sadea , i mean add new gallery sections and add images and image links to replace custom content section

@Jasoliya , Thank you very much, this worked for me!

Have a wonderful day.

Also thank you @Dan-From-Ryviu for the help!

1 Like

Thank you very much!

This worked out for me.

@Jasoliya , can you please add some code so that it opens in A NEW TAB instead of replacing the existing tab? :wink:

add this (target=“_blank”) attribute in

so it will look like this


Thanx you very much, it works great. When the link is empty, the cursor changes on mouse on (but OK, no link after), but is it possible to disable this ?

Regards,

Ludovic