In my controller I have the following code but I want to display also the meta title of the product in the browser. Can anyone help me with this? Thanks!

class Product extends \Magento\Framework\App\Action\Action
protected $pageFactory;
public function __construct(Context $context, PageFactory $pageFactory)
    $this->pageFactory = $pageFactory;
    return parent::__construct($context);

public function execute()
    $page_object = $this->pageFactory->create();
    return $page_object;

1 Answer 1


Try following way

/** @var \Magento\Framework\View\Result\Page $resultPage */
$resultPage = $this->resultPageFactory->create();
// set title

// get title
echo $resultPage->getConfig()->getTitle()->get();

// get meta information

Check available method into following class

  • Thanks for the reply but I need the meta title to be displayed not the page title. any idea?
    – Th. Schott
    Commented Aug 27, 2016 at 15:36
  • check updated answer
    – Sohel Rana
    Commented Aug 27, 2016 at 15:41
  • Unfortunately I cant figure it :-(
    – Th. Schott
    Commented Aug 27, 2016 at 16:04

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.