Categories
Magento 2

Magento 2 – Set page title by layout XML or Controller

By default URL showing as title but thats not good look that appears on the title bar when created a new custom module. There are 2 (two) ways of Set page title by layout XML or Controller.

1. From frontend view layout module_controller_action.xml by head and title tag.

2. From frontend view layout module_controller_action.xml by referenceBlock page.main.title and set setPageTitle argument tag.

Set page title by PHP Controller

Also we can set page title by PHP controller file controllerName.php in method public function execute()

Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Please LIKE and SHARE

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *