How To Use Markup Tags In Links of Magento 2

Posted by

Markup Tags can be used with HTML anchor tags, and link directly to any page of Magento 2 store. You can incorporate the link into content pages, blocks, banners, or email and newsletter templates. You can also link an image to a specific page using the same method.

Step 1: Identify the Destination URL

Open the page that you want to link and copy URL from the address bar, the part of the URL that you need stands after the “.com/”. Otherwise, copy the URL Key from the CMS page that you want to use as the link destination.

Full URL to Category Page

Full URL to Product Page

Full URL to CMS Page

Step 2: Insert the Markup to the URL

The Store URL tag stands for the base URL of your website, and is used as a substitute for the “http address” part of the store URL, including the domain name and “.com”. Depending on the results you want to achieve, there are two tag versions you can use.

store direct_url Links directly to a page
store url Insert a forward slash at the end so that additional references can be appended as a path.

In this example, single quotes enclose the URL key and double curly braces enclose the entire markup tag. When used with an anchor tag, you can place the markup tag inside the double quotes of the anchor. To avoid mistake, use the single and double quotes for each nested set of quotes.

If you’re starting with full URL, delete from “http://” to “.com/”. Type URL markup tag up through the opening single quote.

Store URL Markup Tag

{{store url=’apparel/shoes/womens’}}

Otherwise, type the first part of the Store URL markup tag, and paste the URL key or path that you copied earlier.

Store URL Markup Tag with URL Key

{{store url=’

{{store url=’apparel/shoes/womens’}}

Step 3: Complete the Anchor Tag

Wrap an anchor tag around the completed markup tag, using the markup tag instead of the target URL. Then, add the link text.

Markup in Anchor Tag

<a href=”{{markup tag goes here}}”>Link Text</a>

Paste the anchor tag into the code of any CMS block, page, banner, or email template.

Complete Link with Markup

<a href=”{{store url=’apparel/shoes’}}”>Shoe Sale</a>

Leave a Reply

Your email address will not be published. Required fields are marked *