2

How to change meta title in magento2.3? I am not able to find the title of the home page.

2 Answers 2

2

Open your Magento admin panel and go to:

Content > Pages > Find your home page 

See the screenshot below:-

enter image description here

(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):-

enter image description here

1
<?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;
    }
}

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.