Magento 2-How to link image to category page through cms page?
-
13-12-2020 - |
题
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?
解决方案
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>