Magento 2 : Getting rid of meta description tag on product pages
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&path=63_81&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
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.
add a comment |
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&path=63_81&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
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.
add a comment |
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&path=63_81&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
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&path=63_81&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
magento2 product meta-tags
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.
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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/
add a comment |
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.
Can we puthtmlspecialchars
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 puthtmlspecialchar
?
– zed Blackbeard
Apr 22 '16 at 13:36
add a comment |
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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/
add a comment |
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/
add a comment |
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/
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/
edited Jun 3 '18 at 18:54
Rohan Hapani
5,83721662
5,83721662
answered Feb 26 '18 at 8:59
Selestin Thomas
162
162
add a comment |
add a comment |
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.
Can we puthtmlspecialchars
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 puthtmlspecialchar
?
– zed Blackbeard
Apr 22 '16 at 13:36
add a comment |
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.
Can we puthtmlspecialchars
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 puthtmlspecialchar
?
– zed Blackbeard
Apr 22 '16 at 13:36
add a comment |
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.
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.
answered Apr 22 '16 at 12:34
Rakesh Jesadiya
28.6k1571119
28.6k1571119
Can we puthtmlspecialchars
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 puthtmlspecialchar
?
– zed Blackbeard
Apr 22 '16 at 13:36
add a comment |
Can we puthtmlspecialchars
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 puthtmlspecialchar
?
– 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
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Jun 17 '16 at 14:35
Rafael Corrêa Gomes
4,24222962
4,24222962
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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