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;
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
add a comment |
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
check this github.com/magento/magento2/pull/11368
– fmsthird
Jun 4 at 11:37
add a comment |
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
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
magento2 magento-2.2.5 meta-tags meta-title meta-description
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
Use this code to set Metatitle,
$this->_pageConfig->getTitle()->set(__('Your Title'));
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
add a comment |
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']]
);
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%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
Use this code to set Metatitle,
$this->_pageConfig->getTitle()->set(__('Your Title'));
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
add a comment |
Use this code to set Metatitle,
$this->_pageConfig->getTitle()->set(__('Your Title'));
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
add a comment |
Use this code to set Metatitle,
$this->_pageConfig->getTitle()->set(__('Your Title'));
Use this code to set Metatitle,
$this->_pageConfig->getTitle()->set(__('Your Title'));
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
add a comment |
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
add a comment |
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']]
);
add a comment |
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']]
);
add a comment |
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']]
);
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']]
);
answered 2 days ago
oscprofessionalsoscprofessionals
37417
37417
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.
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%2f277214%2fmagento2-not-showing-meta-title-description-on-category-page%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
check this github.com/magento/magento2/pull/11368
– fmsthird
Jun 4 at 11:37