Skip to main content
[Edit removed during grace period]; deleted 19 characters in body
Source Link
rou6e
  • 1k
  • 10
  • 11

public function execute() { $resultPage = $this->resultPageFactory->create(); // Handling page title $resultPage->getLayout()->getBlock('page.main.title')->setPageTitle('Page title here'); // Handling meta_titleJust tried myself for a new custom extension, meta_description and meta_keywords $resultPage->getConfig()->getTitle()->set("Title"); $resultPage->getConfig()->setDescription("Description"); $resultPage->getConfig()->setKeywords("Key Words"); return $resultPage; }it works for me :

public function execute() {
    $resultPage = $this->resultPageFactory->create();
    // Handling page title
    $resultPage->getLayout()->getBlock('page.main.title')->setPageTitle('Page title here');
    // Handling meta_title, meta_description and meta_keywords
    $resultPage->getConfig()->getTitle()->set("Title");
    $resultPage->getConfig()->setDescription("Description");
    $resultPage->getConfig()->setKeywords("Key Words");
    return $resultPage;
}

It shoud do the job !

public function execute() { $resultPage = $this->resultPageFactory->create(); // Handling page title $resultPage->getLayout()->getBlock('page.main.title')->setPageTitle('Page title here'); // Handling meta_title, meta_description and meta_keywords $resultPage->getConfig()->getTitle()->set("Title"); $resultPage->getConfig()->setDescription("Description"); $resultPage->getConfig()->setKeywords("Key Words"); return $resultPage; }

It shoud do the job !

Just tried myself for a new custom extension, it works for me :

public function execute() {
    $resultPage = $this->resultPageFactory->create();
    // Handling page title
    $resultPage->getLayout()->getBlock('page.main.title')->setPageTitle('Page title here');
    // Handling meta_title, meta_description and meta_keywords
    $resultPage->getConfig()->getTitle()->set("Title");
    $resultPage->getConfig()->setDescription("Description");
    $resultPage->getConfig()->setKeywords("Key Words");
    return $resultPage;
}

It shoud do the job !

Post Undeleted by rou6e
Post Deleted by rou6e
Source Link
rou6e
  • 1k
  • 10
  • 11

public function execute() { $resultPage = $this->resultPageFactory->create(); // Handling page title $resultPage->getLayout()->getBlock('page.main.title')->setPageTitle('Page title here'); // Handling meta_title, meta_description and meta_keywords $resultPage->getConfig()->getTitle()->set("Title"); $resultPage->getConfig()->setDescription("Description"); $resultPage->getConfig()->setKeywords("Key Words"); return $resultPage; }

It shoud do the job !