Magento 2 – Set Title and Script in Contact Page

contact-usheadmagento2title

I'd like to set the title and add some scripts in the default Magento Contact page . So in my theme's directory I have added the following file:

Magento_Contact/layout/contact_index_index.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="cms_page_layout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <title>Contact1</title>
        <script src="https://....."/>
    </head>
</page>

which is not working. Am I missing something here?

——————————–UPDATE————————————-

It seems that many pages have the same issue in my website. Many product pages (not all of them) and some other pages have head title "Create New Customer Account". I have no idea where this comes from and why it affects these pages like that. Any method tested in order to set the head title in these page fails.

Best Answer

you can try this :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
layout="1column"xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  <head>
      <title>Contact1</title>
      <css src="css/local-l.css"/>
  </head>
</page>

Run php bin/magento setup:upgrade.
Related Topic