Changing a page title helps you to improve the SEO of your website. For product pages, we can manage that with the backend but on other pages, such as the contact page, we can't do that.
In this recipe, we will change the page title of the contact page that is available at the /contact
path.
To change the page title of the contact page, have a look at the following steps:
Go to the contact page in the frontend. This is available at the path
/contact
.You see that the page title is set to Contact Us. We will change this to Give us a message.
Create the file
contact_index_index.xml
in the folderapp/design/frontend/Packt/cookbook/Magento_Contact/layout
. If that folder doesn't exist, create it.In the
contact_index_index.xml
file, paste the following content:<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> ...