How to change meta title in magento2.3? I am not able to find the title of the home page.
2 Answers
Open your Magento admin panel and go to:
Content > Pages > Find your home page
See the screenshot below:-
(If you can't find which CMS Page your homepage is set as, you can confirm this by going to Stores -> Configuration -> General -> Web -> Default Pages -> CMS Home Page, which will show you which page is being used)
Add your meta title and flush the Magento cache (run the php bin/magento c:f
command in CLI)
Finally go onto the front-end of your website and check the changes. (See screenshot below):-
<?php
namespace VENDOR\MODULE\Controller\Test;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\View\Result\PageFactory;
class Index extends Action
{
/**
* @var PageFactory
*/
private $pageFactory;
public function __construct(Context $context,
PageFactory $pageFactory)
{
parent::__construct($context);
$this->pageFactory = $pageFactory;
}
/**
* Execute action based on request and return result
*
* Note: Request will be added as operation argument in future
*
* @return \Magento\Framework\Controller\ResultInterface|ResponseInterface
* @throws \Magento\Framework\Exception\NotFoundException
*/
public function execute()
{
$pageFactory = $this->pageFactory->create();
$pageFactory->getConfig()->getTitle()->set('Your Title');
return $pageFactory;
}
}