I'm getting issue with website meta info. If I will set the default meta info then it will display the same info tag for all the pages.

But when I'm trying to set the meta info for particular page then it will not display the Meta title & description.

I have set the Meta description & title for one category. In this case the Meta description & title tag showing for the same category page.

Solution I applied to display the both the tags for category pages:

I have created one observer & set the description for the current category. But when I tried to set the title then I got below error.

Recoverable Error: Object of class Magento\Framework\View\Page\Title could not be converted to string in /var/www/html/htdocs/vendor/magento/framework/View/Page/Config/Renderer.php on line 125

I used below code to set the meta title & description.

$this->_pageConfig->setMetadata('title', 'some meta title');



Thanks for any help.


Use this code to set Metatitle,

$this->_pageConfig->getTitle()->set(__('Your Title'));

  • Hi @aravind, I have checked the same. It's also not working. It will not add the meta tag. – Deepak Kumar Jun 4 '19 at 12:31
  • hello @DeepakKumar could you see the description and keywords set? – aravind Jun 4 '19 at 12:33
  • The keywords showing by default. But the description also was not showing so I have added the meta description through observer. So now the description is showing but the title not. – Deepak Kumar Jun 4 '19 at 12:44
  • could you show me the updated code of setting the title. – aravind Jun 4 '19 at 12:52
  • I have set the title by using the above shared functions by me & the function shared by you. But nothing working for the same. – Deepak Kumar Jun 4 '19 at 13:03

Refer block and its method,


In this way you can set the meta title and Description,

$category = $this->getCurrentCategory();
if ($category) {
    $title = $category->getMetaTitle();
    if ($title) {
    $description = $category->getMetaDescription();
    if ($description) {
    $keywords = $category->getMetaKeywords();
    if ($keywords) {
    if ($this->_categoryHelper->canUseCanonicalTag()) {
            ['attributes' => ['rel' => 'canonical']]

  • Hi @oscprofessionals it will update the meta title into the page title. But my concern is with the meta title tag that not showing to the category & product page. – Deepak Kumar Jun 13 '19 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.