I want to modify the page title of the customer login page.

What is the simple way to modify the page title?

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

4 Answers 4


You can set title using below code:

<referenceBlock name="page.main.title">
    <action method="setPageTitle">
        <argument translate="true" name="title" xsi:type="string">My Dashboard</argument>

If you want to change customer login create a file name with customer_account_login.xml add below code:

<?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">

        <!-- and for the page title: -->
        <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">Recipe</argument>


Put this function in Block page of that Module

public function _prepareLayout()  

   $this->pageConfig->getTitle()->set(__('Your Page Title'));  

   return parent::_prepareLayout();  

Also, check if your page title is being set by multiple modules. Depending on what you have installed, and the sequence, the page title can wind up being reset by something else after trying to set it.

I ran into a case where the page title was being set 4 times, and had to find the last one in the sequence and write a plugin to override that.


Page title can be set via layout XML file:

<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        <title>Custom Title</title>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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