How to get Meta data in title.phtml on Magento2 Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How to change the generated “Meta Information” for a product?Adding dynamic data in headChange Meta Tag for different pagesHow to put Meta Title PageProduct pages all have meta titles from 2 different pages combinedPre populate description meta dataChange Meta tag information dynamically, with JqueryHow to srtip all html from page layout in Magento2Magento2 : How to set custom meta title & meta description by observer?Magento 2: Meta-keywords and meta-description doesn't appear

How to find all the available tools in mac terminal?

Using et al. for a last / senior author rather than for a first author

Overriding an object in memory with placement new

How to bypass password on Windows XP account?

Why is my conclusion inconsistent with the van't Hoff equation?

How to align text above triangle figure

How come Sam didn't become Lord of Horn Hill?

How discoverable are IPv6 addresses and AAAA names by potential attackers?

Can a non-EU citizen traveling with me come with me through the EU passport line?

Denied boarding although I have proper visa and documentation. To whom should I make a complaint?

Why did the Falcon Heavy center core fall off the ASDS OCISLY barge?

Why do we bend a book to keep it straight?

What's the meaning of 間時肆拾貳 at a car parking sign

English words in a non-english sci-fi novel

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

What does an IRS interview request entail when called in to verify expenses for a sole proprietor small business?

Error "illegal generic type for instanceof" when using local classes

What is a non-alternating simple group with big order, but relatively few conjugacy classes?

How do I keep my slimes from escaping their pens?

Apollo command module space walk?

List of Python versions

Identify plant with long narrow paired leaves and reddish stems

How can I make names more distinctive without making them longer?

In predicate logic, does existential quantification (∃) include universal quantification (∀), i.e. can 'some' imply 'all'?



How to get Meta data in title.phtml on Magento2



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How to change the generated “Meta Information” for a product?Adding dynamic data in headChange Meta Tag for different pagesHow to put Meta Title PageProduct pages all have meta titles from 2 different pages combinedPre populate description meta dataChange Meta tag information dynamically, with JqueryHow to srtip all html from page layout in Magento2Magento2 : How to set custom meta title & meta description by observer?Magento 2: Meta-keywords and meta-description doesn't appear



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








2















I am trying to get the current pages meta data in title.phtml on Magento 2 so that I can have a sub title and slight description on the page.



But I cant find anything for how to retrieve this information, only how to set it.



I have tried things like:



$this->pageConfig->getTitle();


and



$this->getLayout()->getBlock('head')->getTitle();


and



$resultPage->getConfig()->getTitle()


But all without success. I know this is all quite new at the moment but can anyone tell me how to do this?










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.





















    2















    I am trying to get the current pages meta data in title.phtml on Magento 2 so that I can have a sub title and slight description on the page.



    But I cant find anything for how to retrieve this information, only how to set it.



    I have tried things like:



    $this->pageConfig->getTitle();


    and



    $this->getLayout()->getBlock('head')->getTitle();


    and



    $resultPage->getConfig()->getTitle()


    But all without success. I know this is all quite new at the moment but can anyone tell me how to do this?










    share|improve this question
















    bumped to the homepage by Community yesterday


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      2












      2








      2








      I am trying to get the current pages meta data in title.phtml on Magento 2 so that I can have a sub title and slight description on the page.



      But I cant find anything for how to retrieve this information, only how to set it.



      I have tried things like:



      $this->pageConfig->getTitle();


      and



      $this->getLayout()->getBlock('head')->getTitle();


      and



      $resultPage->getConfig()->getTitle()


      But all without success. I know this is all quite new at the moment but can anyone tell me how to do this?










      share|improve this question
















      I am trying to get the current pages meta data in title.phtml on Magento 2 so that I can have a sub title and slight description on the page.



      But I cant find anything for how to retrieve this information, only how to set it.



      I have tried things like:



      $this->pageConfig->getTitle();


      and



      $this->getLayout()->getBlock('head')->getTitle();


      and



      $resultPage->getConfig()->getTitle()


      But all without success. I know this is all quite new at the moment but can anyone tell me how to do this?







      magento2 meta-tags meta






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 11 '18 at 15:59









      Sourabh Kumar Sharma

      671316




      671316










      asked Aug 14 '16 at 5:05









      justnormjustnorm

      315




      315





      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          1 Answer
          1






          active

          oldest

          votes


















          0














          A way to get the meta data could be:



          $objectManager = MagentoFrameworkAppObjectManager::getInstance();
          $_page = $objectManager->get('MagentoCmsModelPage');

          $_meta_title = strip_tags($_page->getMetaTitle());
          $_meta_description = strip_tags($_page->getMetaDescription());
          $_meta_keywords = strip_tags($_page->getMetaKeywords());


          However this does not take into account the default settings under Content > Design > Configuration > HTML Head



          This only works for cms pages, i guess.



          Finally i used this in my case:



          $objectManager = MagentoFrameworkAppObjectManager::getInstance();
          $_page_config = $objectManager->get('MagentoFrameworkViewPageConfig');

          $_meta_title = strip_tags($_page_config->getTitle()->getShort());
          $_meta_description = strip_tags($_page_config->getDescription());
          $_meta_keywords = strip_tags($_page_config->getKeywords());


          Have look in the MagentoFrameworkViewPageConfig i think there is literally a getMetadata method.






          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%2f131366%2fhow-to-get-meta-data-in-title-phtml-on-magento2%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            A way to get the meta data could be:



            $objectManager = MagentoFrameworkAppObjectManager::getInstance();
            $_page = $objectManager->get('MagentoCmsModelPage');

            $_meta_title = strip_tags($_page->getMetaTitle());
            $_meta_description = strip_tags($_page->getMetaDescription());
            $_meta_keywords = strip_tags($_page->getMetaKeywords());


            However this does not take into account the default settings under Content > Design > Configuration > HTML Head



            This only works for cms pages, i guess.



            Finally i used this in my case:



            $objectManager = MagentoFrameworkAppObjectManager::getInstance();
            $_page_config = $objectManager->get('MagentoFrameworkViewPageConfig');

            $_meta_title = strip_tags($_page_config->getTitle()->getShort());
            $_meta_description = strip_tags($_page_config->getDescription());
            $_meta_keywords = strip_tags($_page_config->getKeywords());


            Have look in the MagentoFrameworkViewPageConfig i think there is literally a getMetadata method.






            share|improve this answer





























              0














              A way to get the meta data could be:



              $objectManager = MagentoFrameworkAppObjectManager::getInstance();
              $_page = $objectManager->get('MagentoCmsModelPage');

              $_meta_title = strip_tags($_page->getMetaTitle());
              $_meta_description = strip_tags($_page->getMetaDescription());
              $_meta_keywords = strip_tags($_page->getMetaKeywords());


              However this does not take into account the default settings under Content > Design > Configuration > HTML Head



              This only works for cms pages, i guess.



              Finally i used this in my case:



              $objectManager = MagentoFrameworkAppObjectManager::getInstance();
              $_page_config = $objectManager->get('MagentoFrameworkViewPageConfig');

              $_meta_title = strip_tags($_page_config->getTitle()->getShort());
              $_meta_description = strip_tags($_page_config->getDescription());
              $_meta_keywords = strip_tags($_page_config->getKeywords());


              Have look in the MagentoFrameworkViewPageConfig i think there is literally a getMetadata method.






              share|improve this answer



























                0












                0








                0







                A way to get the meta data could be:



                $objectManager = MagentoFrameworkAppObjectManager::getInstance();
                $_page = $objectManager->get('MagentoCmsModelPage');

                $_meta_title = strip_tags($_page->getMetaTitle());
                $_meta_description = strip_tags($_page->getMetaDescription());
                $_meta_keywords = strip_tags($_page->getMetaKeywords());


                However this does not take into account the default settings under Content > Design > Configuration > HTML Head



                This only works for cms pages, i guess.



                Finally i used this in my case:



                $objectManager = MagentoFrameworkAppObjectManager::getInstance();
                $_page_config = $objectManager->get('MagentoFrameworkViewPageConfig');

                $_meta_title = strip_tags($_page_config->getTitle()->getShort());
                $_meta_description = strip_tags($_page_config->getDescription());
                $_meta_keywords = strip_tags($_page_config->getKeywords());


                Have look in the MagentoFrameworkViewPageConfig i think there is literally a getMetadata method.






                share|improve this answer















                A way to get the meta data could be:



                $objectManager = MagentoFrameworkAppObjectManager::getInstance();
                $_page = $objectManager->get('MagentoCmsModelPage');

                $_meta_title = strip_tags($_page->getMetaTitle());
                $_meta_description = strip_tags($_page->getMetaDescription());
                $_meta_keywords = strip_tags($_page->getMetaKeywords());


                However this does not take into account the default settings under Content > Design > Configuration > HTML Head



                This only works for cms pages, i guess.



                Finally i used this in my case:



                $objectManager = MagentoFrameworkAppObjectManager::getInstance();
                $_page_config = $objectManager->get('MagentoFrameworkViewPageConfig');

                $_meta_title = strip_tags($_page_config->getTitle()->getShort());
                $_meta_description = strip_tags($_page_config->getDescription());
                $_meta_keywords = strip_tags($_page_config->getKeywords());


                Have look in the MagentoFrameworkViewPageConfig i think there is literally a getMetadata method.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 8 '17 at 12:44

























                answered Mar 8 '17 at 9:39









                QuintenQuinten

                1012




                1012



























                    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%2f131366%2fhow-to-get-meta-data-in-title-phtml-on-magento2%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