cancel
Showing results for 
Search instead for 
Did you mean: 

Meta title question

Meta title question

Hello,

How to set different meta title for the same page. I am getting meta title data based on the page url (?id=1)

...
1 REPLY 1

Re: Meta title question

Hello @i2ulanecav12bf 

 

In Magento 2, setting different meta titles for the same page (like for different store views or customer groups) can be done using the following methods:

 

If you need to set meta titles programmatically or for specific conditions, you can use XML layout files. 

Create or Modify a Module:

Create Layout XML:

  • In your module, create a layout XML file under view/frontend/layout/ (for example, cms_page_view.xml).

Add the Meta Title:

  • Add the following code to your layout file:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <title>Your Custom Meta Title</title>
    </head>
</page>

 

Conditional Logic (if needed): If you want to change the title based on conditions, you can implement that logic in a custom block or observer.

 

Run all magento standard commands and clean cache:

 

Hope it helps !

If you find our reply helpful, please give us kudos.

 

A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.

 

WebDesk Solution Support Team

Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789

 

 

Thank You,


WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789


Location: 150 King St. W. Toronto, ON M5H 1J9