How to get Meta data in title.phtml on Magento2 Planned maintenance scheduled April 23, 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
Using audio cues to encourage good posture
How does Python know the values already stored in its memory?
Can anything be seen from the center of the Boötes void? How dark would it be?
Take 2! Is this homebrew Lady of Pain warlock patron balanced?
How much damage would a cupful of neutron star matter do to the Earth?
Crossing US/Canada Border for less than 24 hours
How does light 'choose' between wave and particle behaviour?
ArcGIS Pro Python arcpy.CreatePersonalGDB_management
Is it a good idea to use CNN to classify 1D signal?
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
What initially awakened the Balrog?
Sum letters are not two different
How can I reduce the gap between left and right of cdot with a macro?
Should I use a zero-interest credit card for a large one-time purchase?
Why wasn't DOSKEY integrated with COMMAND.COM?
How were pictures turned from film to a big picture in a picture frame before digital scanning?
Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?
Trademark violation for app?
What is this clumpy 20-30cm high yellow-flowered plant?
Significance of Cersei's obsession with elephants?
Generate an RGB colour grid
A term for a woman complaining about things/begging in a cute/childish way
How do I find out the mythology and history of my Fortress?
How often does castling occur in grandmaster games?
How to get Meta data in title.phtml on Magento2
Planned maintenance scheduled April 23, 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
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
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
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