I'm having issues with the website's meta information. If I set the default meta information, it will display the same information tag for all the pages.

But when I'm trying to set the meta info for a specific page then the Meta title and description do not display.

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 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 the 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 the below code to set the meta title & description.

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



Thanks for any help.


2 Answers 2


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. Jun 4, 2019 at 12:31
  • hello @DeepakKumar could you see the description and keywords set?
    – aravind
    Jun 4, 2019 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. Jun 4, 2019 at 12:44
  • could you show me the updated code of setting the title.
    – aravind
    Jun 4, 2019 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. Jun 4, 2019 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. Jun 13, 2019 at 13:18

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.