Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi, I use SeoToolkit plugin 2.3.0 with Umbraco 10
The question is how to get Meta data for current page from the code?
I tried to do this in this way:
string metaTitle = currentPage.HasValue("metaTitle") ? currentPage.Value<string>("metaTitle") : null; string metaDescription = currentPage.HasValue("metaDescription") ? currentPage.Value<string>("metaDescription") : null; string metaKeywords = currentPage.HasValue("metaKeywords") ? currentPage.Value<string>("metaKeywords") : null;
But no result.
I need this to reuse this metadata for Microdata shema.org
<script type="application/ld+json"> { "@@context": "https://schema.org/", "@@type": "Product", "name": "Executive Anvil", "description": "@metaDescription", } </script>
Hi Dan,
If you want to get the meta values from a node, you should inject IMetaFieldsService and pass the currentPage. This will then give back a model with all the values you want.
An example can be found here: https://github.com/patrickdemooij9/SeoToolkit.Umbraco/blob/dev/Umbraco11/src/SeoToolkit.Umbraco.MetaFields.Core/Common/TagHelpers/MetaFieldsTagHelper.cs
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
SeoToolkit how to get Meta data in code
Hi, I use SeoToolkit plugin 2.3.0 with Umbraco 10
The question is how to get Meta data for current page from the code?
I tried to do this in this way:
But no result.
I need this to reuse this metadata for Microdata shema.org
Hi Dan,
If you want to get the meta values from a node, you should inject IMetaFieldsService and pass the currentPage. This will then give back a model with all the values you want.
An example can be found here: https://github.com/patrickdemooij9/SeoToolkit.Umbraco/blob/dev/Umbraco11/src/SeoToolkit.Umbraco.MetaFields.Core/Common/TagHelpers/MetaFieldsTagHelper.cs
is working on a reply...