Magento 2 – How to Link Image to Category Page Through CMS Page

categorycms-pagesmagento2magento2.3url

I have a static page of shop. On this page there are different images. I want to link these images to the specific categories types.
For example i have an image of men's clothes. Now i have also a category of men's clothes. on clicking the image it should go to that category. As this page is made from the admin>content>pages. I am not able to get the base url or the link url.

Some one can help me in this regard?

Best Answer

Please use below code for link in static page

<a href="{{config path="web/unsecure/base_url"}}<<YOUR CATEGORY URL KEY>>" target="_self"><img src="{{media url="wysiwyg/clothing.png"}}" alt="" width="IMGWIDTH" height="IMGHEIGHT" /></a>

OR

<a href="{{store url='YOUR CATEGORY URL KEY'}}" target="_self"><img src="{{media url="wysiwyg/clothing.png"}}" alt="" width="IMGWIDTH" height="IMGHEIGHT" /></a>
Related Topic