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;
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
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 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
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 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
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
magento2 meta-tags meta
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.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
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%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
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.
add a comment |
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.
add a comment |
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.
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.
edited Mar 8 '17 at 12:44
answered Mar 8 '17 at 9:39
QuintenQuinten
1012
1012
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%2f131366%2fhow-to-get-meta-data-in-title-phtml-on-magento2%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