0

Trying to change the meta title of the customer login page in Magento2 at example.com/customer/account/login/. Added tag to my xml file but no luck. Please advise.

Here's my xml layout:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<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>Member Login</title>
    </head> 
    <body>
        <referenceContainer name="content">
            <!-- customer.form.login.extra -->
            <referenceBlock name="page.main.title">
                <action method="setPageTitle">
                    <argument translate="true" name="title" xsi:type="string">Member Login</argument>
                </action>
            </referenceBlock>
            <container name="customer.login.container" label="Customer Login Container" htmlTag="div" htmlClass="login-container">
                <block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="form/login.phtml">
                    <container name="form.additional.info" as="form_additional_info"/>
                </block>
                <block class="Magento\Customer\Block\Form\Login\Info" name="customer.new" template="newcustomer.phtml"/>
            </container>
            <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
                <arguments>
                    <argument name="triggers" xsi:type="array">
                        <item name="loginButton" xsi:type="string">.action.login</item>
                    </argument>
                </arguments>
            </block>
        </referenceContainer>
        <referenceContainer name="form.additional.info">
            <block class="Magento\Framework\View\Element\Template" name="form_additional_info_customer" template="Magento_Customer::additionalinfocustomer.phtml"/>
        </referenceContainer>
    </body>
</page>
0

Looking into where the title is set. This is a function under \Build\vendor\magento\module-customer\Block\Form\Login.php

It contains the following code -

/**
 * @return $this
 */
protected function _prepareLayout()
{
    $this->pageConfig->getTitle()->set(__('Customer Login'));
    return parent::_prepareLayout();
}

You could override this with an extension, but the easiest is probably to translate "Customer Login" as "Member Login" (assuming you are happy for that to change in all places that the text appears, such as the page title).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.