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

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

                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?