Magento 2 : Getting rid of meta description tag on product pages












1














I am using editor for product description and there are HTML tags in them. Magento uses product description in product page meta tag description. My designs are going weird.



Here is the meta tag description.



<meta name="description" content="<p><strong>ABDE product</strong></p>
<p>Also available in <a href="domainname/index.php?route=product/product&amp;path=63_81&amp;product_id=188#.VkoVJuL642g"><span style="text-decoration: underline;"><strong>Black</st"/>
<meta name="keywords" content="Magento, Varien, E-commerce"/>


Ref Image : Click here



How to fix this issue. Any issue would be appreciated.










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.




















    1














    I am using editor for product description and there are HTML tags in them. Magento uses product description in product page meta tag description. My designs are going weird.



    Here is the meta tag description.



    <meta name="description" content="<p><strong>ABDE product</strong></p>
    <p>Also available in <a href="domainname/index.php?route=product/product&amp;path=63_81&amp;product_id=188#.VkoVJuL642g"><span style="text-decoration: underline;"><strong>Black</st"/>
    <meta name="keywords" content="Magento, Varien, E-commerce"/>


    Ref Image : Click here



    How to fix this issue. Any issue would be appreciated.










    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.


















      1












      1








      1







      I am using editor for product description and there are HTML tags in them. Magento uses product description in product page meta tag description. My designs are going weird.



      Here is the meta tag description.



      <meta name="description" content="<p><strong>ABDE product</strong></p>
      <p>Also available in <a href="domainname/index.php?route=product/product&amp;path=63_81&amp;product_id=188#.VkoVJuL642g"><span style="text-decoration: underline;"><strong>Black</st"/>
      <meta name="keywords" content="Magento, Varien, E-commerce"/>


      Ref Image : Click here



      How to fix this issue. Any issue would be appreciated.










      share|improve this question













      I am using editor for product description and there are HTML tags in them. Magento uses product description in product page meta tag description. My designs are going weird.



      Here is the meta tag description.



      <meta name="description" content="<p><strong>ABDE product</strong></p>
      <p>Also available in <a href="domainname/index.php?route=product/product&amp;path=63_81&amp;product_id=188#.VkoVJuL642g"><span style="text-decoration: underline;"><strong>Black</st"/>
      <meta name="keywords" content="Magento, Varien, E-commerce"/>


      Ref Image : Click here



      How to fix this issue. Any issue would be appreciated.







      magento2 product meta-tags






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 22 '16 at 12:09









      zed Blackbeard

      1,51621240




      1,51621240





      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.
























          3 Answers
          3






          active

          oldest

          votes


















          1














          Add strip_tag function to eliminate HTML tags from meta description.



          File location :




          /vendor/magento/module-catalog/Block/Product/View.php




          Search for the function _prepareLayout



          Update the line


            $description = $product->getMetaDescription();


          With


            $description = strip_tags($product->getMetaDescription());


          For more details refer :http://connectonline.in/magento2-strip-tags-magento-meta-tags/






          share|improve this answer































            0














            You have to check in adminpanel for that product.



            Go to Admin -> Products 


            Open Prodcut
            CLick on left sidebar,Search Engine Optimization tab



            Check Meta Keywords field if it contens html tag then remove it.
            Or clear the value of meta keywords and check.



            After that reindex your site.






            share|improve this answer





















            • Can we put htmlspecialchars char ?
              – zed Blackbeard
              Apr 22 '16 at 13:32












            • you have to keep only text.
              – Rakesh Jesadiya
              Apr 22 '16 at 13:34










            • if i need to put htmlspecialchar ?
              – zed Blackbeard
              Apr 22 '16 at 13:36



















            0














            In recent versions this error has been corrected.
            Change this line to correct.
            app/code/Magento/Catalog/Block/Product/View.php:146



            $this->pageConfig->setDescription($this->string->substr($product->getDescription(), 0, 255));


            to



            $this->pageConfig->setDescription($this->string->substr(strip_tags($product->getDescription()), 0, 255));


            Reference:https://mage2.pro/t/topic/161






            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%2f112164%2fmagento-2-getting-rid-of-meta-description-tag-on-product-pages%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              Add strip_tag function to eliminate HTML tags from meta description.



              File location :




              /vendor/magento/module-catalog/Block/Product/View.php




              Search for the function _prepareLayout



              Update the line


                $description = $product->getMetaDescription();


              With


                $description = strip_tags($product->getMetaDescription());


              For more details refer :http://connectonline.in/magento2-strip-tags-magento-meta-tags/






              share|improve this answer




























                1














                Add strip_tag function to eliminate HTML tags from meta description.



                File location :




                /vendor/magento/module-catalog/Block/Product/View.php




                Search for the function _prepareLayout



                Update the line


                  $description = $product->getMetaDescription();


                With


                  $description = strip_tags($product->getMetaDescription());


                For more details refer :http://connectonline.in/magento2-strip-tags-magento-meta-tags/






                share|improve this answer


























                  1












                  1








                  1






                  Add strip_tag function to eliminate HTML tags from meta description.



                  File location :




                  /vendor/magento/module-catalog/Block/Product/View.php




                  Search for the function _prepareLayout



                  Update the line


                    $description = $product->getMetaDescription();


                  With


                    $description = strip_tags($product->getMetaDescription());


                  For more details refer :http://connectonline.in/magento2-strip-tags-magento-meta-tags/






                  share|improve this answer














                  Add strip_tag function to eliminate HTML tags from meta description.



                  File location :




                  /vendor/magento/module-catalog/Block/Product/View.php




                  Search for the function _prepareLayout



                  Update the line


                    $description = $product->getMetaDescription();


                  With


                    $description = strip_tags($product->getMetaDescription());


                  For more details refer :http://connectonline.in/magento2-strip-tags-magento-meta-tags/







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jun 3 '18 at 18:54









                  Rohan Hapani

                  5,83721662




                  5,83721662










                  answered Feb 26 '18 at 8:59









                  Selestin Thomas

                  162




                  162

























                      0














                      You have to check in adminpanel for that product.



                      Go to Admin -> Products 


                      Open Prodcut
                      CLick on left sidebar,Search Engine Optimization tab



                      Check Meta Keywords field if it contens html tag then remove it.
                      Or clear the value of meta keywords and check.



                      After that reindex your site.






                      share|improve this answer





















                      • Can we put htmlspecialchars char ?
                        – zed Blackbeard
                        Apr 22 '16 at 13:32












                      • you have to keep only text.
                        – Rakesh Jesadiya
                        Apr 22 '16 at 13:34










                      • if i need to put htmlspecialchar ?
                        – zed Blackbeard
                        Apr 22 '16 at 13:36
















                      0














                      You have to check in adminpanel for that product.



                      Go to Admin -> Products 


                      Open Prodcut
                      CLick on left sidebar,Search Engine Optimization tab



                      Check Meta Keywords field if it contens html tag then remove it.
                      Or clear the value of meta keywords and check.



                      After that reindex your site.






                      share|improve this answer





















                      • Can we put htmlspecialchars char ?
                        – zed Blackbeard
                        Apr 22 '16 at 13:32












                      • you have to keep only text.
                        – Rakesh Jesadiya
                        Apr 22 '16 at 13:34










                      • if i need to put htmlspecialchar ?
                        – zed Blackbeard
                        Apr 22 '16 at 13:36














                      0












                      0








                      0






                      You have to check in adminpanel for that product.



                      Go to Admin -> Products 


                      Open Prodcut
                      CLick on left sidebar,Search Engine Optimization tab



                      Check Meta Keywords field if it contens html tag then remove it.
                      Or clear the value of meta keywords and check.



                      After that reindex your site.






                      share|improve this answer












                      You have to check in adminpanel for that product.



                      Go to Admin -> Products 


                      Open Prodcut
                      CLick on left sidebar,Search Engine Optimization tab



                      Check Meta Keywords field if it contens html tag then remove it.
                      Or clear the value of meta keywords and check.



                      After that reindex your site.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Apr 22 '16 at 12:34









                      Rakesh Jesadiya

                      28.6k1571119




                      28.6k1571119












                      • Can we put htmlspecialchars char ?
                        – zed Blackbeard
                        Apr 22 '16 at 13:32












                      • you have to keep only text.
                        – Rakesh Jesadiya
                        Apr 22 '16 at 13:34










                      • if i need to put htmlspecialchar ?
                        – zed Blackbeard
                        Apr 22 '16 at 13:36


















                      • Can we put htmlspecialchars char ?
                        – zed Blackbeard
                        Apr 22 '16 at 13:32












                      • you have to keep only text.
                        – Rakesh Jesadiya
                        Apr 22 '16 at 13:34










                      • if i need to put htmlspecialchar ?
                        – zed Blackbeard
                        Apr 22 '16 at 13:36
















                      Can we put htmlspecialchars char ?
                      – zed Blackbeard
                      Apr 22 '16 at 13:32






                      Can we put htmlspecialchars char ?
                      – zed Blackbeard
                      Apr 22 '16 at 13:32














                      you have to keep only text.
                      – Rakesh Jesadiya
                      Apr 22 '16 at 13:34




                      you have to keep only text.
                      – Rakesh Jesadiya
                      Apr 22 '16 at 13:34












                      if i need to put htmlspecialchar ?
                      – zed Blackbeard
                      Apr 22 '16 at 13:36




                      if i need to put htmlspecialchar ?
                      – zed Blackbeard
                      Apr 22 '16 at 13:36











                      0














                      In recent versions this error has been corrected.
                      Change this line to correct.
                      app/code/Magento/Catalog/Block/Product/View.php:146



                      $this->pageConfig->setDescription($this->string->substr($product->getDescription(), 0, 255));


                      to



                      $this->pageConfig->setDescription($this->string->substr(strip_tags($product->getDescription()), 0, 255));


                      Reference:https://mage2.pro/t/topic/161






                      share|improve this answer


























                        0














                        In recent versions this error has been corrected.
                        Change this line to correct.
                        app/code/Magento/Catalog/Block/Product/View.php:146



                        $this->pageConfig->setDescription($this->string->substr($product->getDescription(), 0, 255));


                        to



                        $this->pageConfig->setDescription($this->string->substr(strip_tags($product->getDescription()), 0, 255));


                        Reference:https://mage2.pro/t/topic/161






                        share|improve this answer
























                          0












                          0








                          0






                          In recent versions this error has been corrected.
                          Change this line to correct.
                          app/code/Magento/Catalog/Block/Product/View.php:146



                          $this->pageConfig->setDescription($this->string->substr($product->getDescription(), 0, 255));


                          to



                          $this->pageConfig->setDescription($this->string->substr(strip_tags($product->getDescription()), 0, 255));


                          Reference:https://mage2.pro/t/topic/161






                          share|improve this answer












                          In recent versions this error has been corrected.
                          Change this line to correct.
                          app/code/Magento/Catalog/Block/Product/View.php:146



                          $this->pageConfig->setDescription($this->string->substr($product->getDescription(), 0, 255));


                          to



                          $this->pageConfig->setDescription($this->string->substr(strip_tags($product->getDescription()), 0, 255));


                          Reference:https://mage2.pro/t/topic/161







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jun 17 '16 at 14:35









                          Rafael Corrêa Gomes

                          4,24222962




                          4,24222962






























                              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.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • 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%2f112164%2fmagento-2-getting-rid-of-meta-description-tag-on-product-pages%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

                              1300-talet

                              1300-talet

                              Display a custom attribute below product name in the front-end Magento 1.9.3.8