How To

How to Add Custom Meta tag in Product View Page in Magento 2

Hello Magento Friends,

I am back with another Magento solution for you. Today’s topic is How to Add Custom Meta tag in Product View Page in Magento 2.

Meta tags provide information about the page to web browsers and search engines. Meta tags are found on the source code of the page. With the help of meta tags, search engines come to know what the page is about.

If you need a custom meta tag for a specific product page in Magento 2, it can be accomplished with the help of the below code. To create a custom meta tag you need not add a custom block, you can use the default block. You can even add as many meta tags as you want.

Let’s start with the Steps on How to Add Custom Meta tag in Product View Page in Magento 2

Steps to Add Custom Meta tag in Product View Page in Magento 2:

Step 1: Go to the below-given path.

app\design\frontend\Themes\Yourtheme\Magento_Catalog\layout\catalog_product_view.xml

Now, add the code as mentioned below

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="head.additional">
            <block class="Magento\Catalog\Block\Product\View" name="meta_type_name" template="Magento_Catalog::product/view/custom_meta_name.phtml" />
        </referenceBlock>
     </body>
</page>

Step 2: Create a file named custom_meta_name.phtml at the following path

app\design\frontend\Themes\Yourtheme\Magento_Catalog\templates\product\view\

Finally, add the below code

<meta >

Conclusion:

Accordingly, you can Add a Custom Meta tag to Product View Page in Magento 2. Our SEO Service can help to increase traffic and rankings of your Magento 2 store. For queries, mention it in the comment part. Share with your friends and stay in touch with us! 

Happy Reading!

Click to rate this post!
[Total: 6 Average: 5]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate 🎖️ Certified Magento Developer👨‍💻. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.🏏

Recent Posts

6 Innovative Tools Revolutionizing E-Commerce Operations

E-commerce has transformed the way consumers shop for products and services and interact with businesses.…

2 days ago

How Upcoming Cookie Changes Will Affect Your E-commerce Website?

The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…

2 days ago

Magento 2: How to Add Header and Footer in Checkout

Hello Magento Friends, In today’s blog, we will discuss adding a header and footer to…

2 days ago

Understanding Flexbox Layout in React Native

Hello React Native Friends, Building a visually appealing and responsive mobile app is crucial in…

4 days ago

HYVÄ Themes Releases: 1.3.6 & 1.3.7 – What’s New

We're thrilled to announce the release of Hyvä Themes 1.3.6 and 1.3.7! These latest updates…

4 days ago

How Modern E-Commerce Platforms Leverage Docker & Kubernetes for Scalability

Your e-commerce platform is surging - orders are rolling in, traffic spikes are becoming the…

5 days ago