Magento2 : Not showing Meta title & description on category page

Grep Match and extract

Diatonic chords of a pentatonic vs blues scale?

How can I remove material from this wood beam?

Why isn't Bash trap working if output is redirected to stdout?

Should I put programming books I wrote a few years ago on my resume?

If there's something that implicates the president why is there then a national security issue? (John Dowd)

Does putting salt first make it easier for attacker to bruteforce the hash?

bash vs. zsh: What are the practical differences?

C++ logging library

NUL delimited variable

What is the Leave No Trace way to dispose of coffee grounds?

How was the airlock installed on the Space Shuttle mid deck?

The origin of the Russian proverb about two hares

Housemarks (superimposed & combined letters, heraldry)

If someone intimidates another person, does the person affected gain the Frightened condition?

Mechanism of Acid Hydrolysis

Use 1 9 6 2 in this order to make 75

Multiband vertical antenna not working as expected

What STL algorithm can determine if exactly one item in a container satisfies a predicate?

What is Gilligan's full Name?

How (un)safe is it to ride barefoot?

How far would a landing Airbus A380 go until it stops with no brakes?

If I had a daughter who (is/were/was) cute, I would be very happy

Why do radiation hardened IC packages often have long leads?



Magento2 : Not showing Meta title & description on category page







.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















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 MagentoFrameworkViewPageTitle
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');



$this->_pageConfig->setDescription($desc);



$this->_pageConfig->setKeywords($keyWrds);




Thanks for any help.










share|improve this question






















  • check this github.com/magento/magento2/pull/11368

    – fmsthird
    Jun 4 at 11:37

















1















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 MagentoFrameworkViewPageTitle
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');



$this->_pageConfig->setDescription($desc);



$this->_pageConfig->setKeywords($keyWrds);




Thanks for any help.










share|improve this question






















  • check this github.com/magento/magento2/pull/11368

    – fmsthird
    Jun 4 at 11:37













1












1








1








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 MagentoFrameworkViewPageTitle
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');



$this->_pageConfig->setDescription($desc);



$this->_pageConfig->setKeywords($keyWrds);




Thanks for any help.










share|improve this question














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 MagentoFrameworkViewPageTitle
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');



$this->_pageConfig->setDescription($desc);



$this->_pageConfig->setKeywords($keyWrds);




Thanks for any help.







magento2 magento-2.2.5 meta-tags meta-title meta-description






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 4 at 11:23









Deepak KumarDeepak Kumar

3614




3614












  • check this github.com/magento/magento2/pull/11368

    – fmsthird
    Jun 4 at 11:37

















  • check this github.com/magento/magento2/pull/11368

    – fmsthird
    Jun 4 at 11:37
















check this github.com/magento/magento2/pull/11368

– fmsthird
Jun 4 at 11:37





check this github.com/magento/magento2/pull/11368

– fmsthird
Jun 4 at 11:37










2 Answers
2






active

oldest

votes


















0














Use this code to set Metatitle,



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






share|improve this answer























  • Hi @aravind, I have checked the same. It's also not working. It will not add the meta tag.

    – Deepak Kumar
    Jun 4 at 12:31











  • hello @DeepakKumar could you see the description and keywords set?

    – aravind
    Jun 4 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 at 12:44











  • could you show me the updated code of setting the title.

    – aravind
    Jun 4 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 at 13:03


















0














Refer block and its method,




MagentoCatalogBlockCategoryView::_prepareLayout()




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



$category = $this->getCurrentCategory();
if ($category)
$title = $category->getMetaTitle();
if ($title)
$this->pageConfig->getTitle()->set($title);

$description = $category->getMetaDescription();
if ($description)
$this->pageConfig->setDescription($description);

$keywords = $category->getMetaKeywords();
if ($keywords)
$this->pageConfig->setKeywords($keywords);

if ($this->_categoryHelper->canUseCanonicalTag())
$this->pageConfig->addRemotePageAsset(
$category->getUrl(),
'canonical',
['attributes' => ['rel' => 'canonical']]
);








share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f277214%2fmagento2-not-showing-meta-title-description-on-category-page%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Use this code to set Metatitle,



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






    share|improve this answer























    • Hi @aravind, I have checked the same. It's also not working. It will not add the meta tag.

      – Deepak Kumar
      Jun 4 at 12:31











    • hello @DeepakKumar could you see the description and keywords set?

      – aravind
      Jun 4 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 at 12:44











    • could you show me the updated code of setting the title.

      – aravind
      Jun 4 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 at 13:03















    0














    Use this code to set Metatitle,



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






    share|improve this answer























    • Hi @aravind, I have checked the same. It's also not working. It will not add the meta tag.

      – Deepak Kumar
      Jun 4 at 12:31











    • hello @DeepakKumar could you see the description and keywords set?

      – aravind
      Jun 4 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 at 12:44











    • could you show me the updated code of setting the title.

      – aravind
      Jun 4 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 at 13:03













    0












    0








    0







    Use this code to set Metatitle,



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






    share|improve this answer













    Use this code to set Metatitle,



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







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jun 4 at 12:14









    aravindaravind

    501113




    501113












    • Hi @aravind, I have checked the same. It's also not working. It will not add the meta tag.

      – Deepak Kumar
      Jun 4 at 12:31











    • hello @DeepakKumar could you see the description and keywords set?

      – aravind
      Jun 4 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 at 12:44











    • could you show me the updated code of setting the title.

      – aravind
      Jun 4 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 at 13:03

















    • Hi @aravind, I have checked the same. It's also not working. It will not add the meta tag.

      – Deepak Kumar
      Jun 4 at 12:31











    • hello @DeepakKumar could you see the description and keywords set?

      – aravind
      Jun 4 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 at 12:44











    • could you show me the updated code of setting the title.

      – aravind
      Jun 4 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 at 13:03
















    Hi @aravind, I have checked the same. It's also not working. It will not add the meta tag.

    – Deepak Kumar
    Jun 4 at 12:31





    Hi @aravind, I have checked the same. It's also not working. It will not add the meta tag.

    – Deepak Kumar
    Jun 4 at 12:31













    hello @DeepakKumar could you see the description and keywords set?

    – aravind
    Jun 4 at 12:33






    hello @DeepakKumar could you see the description and keywords set?

    – aravind
    Jun 4 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 at 12:44





    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 at 12:44













    could you show me the updated code of setting the title.

    – aravind
    Jun 4 at 12:52





    could you show me the updated code of setting the title.

    – aravind
    Jun 4 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 at 13:03





    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 at 13:03













    0














    Refer block and its method,




    MagentoCatalogBlockCategoryView::_prepareLayout()




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



    $category = $this->getCurrentCategory();
    if ($category)
    $title = $category->getMetaTitle();
    if ($title)
    $this->pageConfig->getTitle()->set($title);

    $description = $category->getMetaDescription();
    if ($description)
    $this->pageConfig->setDescription($description);

    $keywords = $category->getMetaKeywords();
    if ($keywords)
    $this->pageConfig->setKeywords($keywords);

    if ($this->_categoryHelper->canUseCanonicalTag())
    $this->pageConfig->addRemotePageAsset(
    $category->getUrl(),
    'canonical',
    ['attributes' => ['rel' => 'canonical']]
    );








    share|improve this answer



























      0














      Refer block and its method,




      MagentoCatalogBlockCategoryView::_prepareLayout()




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



      $category = $this->getCurrentCategory();
      if ($category)
      $title = $category->getMetaTitle();
      if ($title)
      $this->pageConfig->getTitle()->set($title);

      $description = $category->getMetaDescription();
      if ($description)
      $this->pageConfig->setDescription($description);

      $keywords = $category->getMetaKeywords();
      if ($keywords)
      $this->pageConfig->setKeywords($keywords);

      if ($this->_categoryHelper->canUseCanonicalTag())
      $this->pageConfig->addRemotePageAsset(
      $category->getUrl(),
      'canonical',
      ['attributes' => ['rel' => 'canonical']]
      );








      share|improve this answer

























        0












        0








        0







        Refer block and its method,




        MagentoCatalogBlockCategoryView::_prepareLayout()




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



        $category = $this->getCurrentCategory();
        if ($category)
        $title = $category->getMetaTitle();
        if ($title)
        $this->pageConfig->getTitle()->set($title);

        $description = $category->getMetaDescription();
        if ($description)
        $this->pageConfig->setDescription($description);

        $keywords = $category->getMetaKeywords();
        if ($keywords)
        $this->pageConfig->setKeywords($keywords);

        if ($this->_categoryHelper->canUseCanonicalTag())
        $this->pageConfig->addRemotePageAsset(
        $category->getUrl(),
        'canonical',
        ['attributes' => ['rel' => 'canonical']]
        );








        share|improve this answer













        Refer block and its method,




        MagentoCatalogBlockCategoryView::_prepareLayout()




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



        $category = $this->getCurrentCategory();
        if ($category)
        $title = $category->getMetaTitle();
        if ($title)
        $this->pageConfig->getTitle()->set($title);

        $description = $category->getMetaDescription();
        if ($description)
        $this->pageConfig->setDescription($description);

        $keywords = $category->getMetaKeywords();
        if ($keywords)
        $this->pageConfig->setKeywords($keywords);

        if ($this->_categoryHelper->canUseCanonicalTag())
        $this->pageConfig->addRemotePageAsset(
        $category->getUrl(),
        'canonical',
        ['attributes' => ['rel' => 'canonical']]
        );









        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 days ago









        oscprofessionalsoscprofessionals

        37417




        37417



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f277214%2fmagento2-not-showing-meta-title-description-on-category-page%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form