I would be surprised if the MetaDataContent
field in Sitecore is a Rich Text
field, I would expect that it should more likely be a Multiline Text
, perhaps with the value of the field containing the exact meta text (including tags) that should be output:
<meta name="description" content="Lorem ipsum dolor sit amet, consectetur adipiscing elit.">
<meta name="keywords" content="Lorem, ipsum, dolor, sit, amet">
...
The rich text field will not show the meta tags in Design view, the user would have to switch to the HTML view. You also don't want the overhead and potential misuse of the formatting options.
That said, generally speaking you should make this more user-friendly for your editors and provide them with multiple (single-line text) fields to allow them to enter the metadata values, rather than also having to explicitly type out the meta tag elements as well, for example:
<meta name="description" content="@Model.Item.Fields["MetaDataDescription"].Value">
<meta name="keywords" content="@Model.Item.Fields["MetaDataKeywords"].Value">
...
MetaData.cshtml
into your layout via a partial. You should use@Html.Sitecore().Rendering("{guid}")
instead, so you can add caching opportunities to your renderings. – Dylan Young Jan 29 '18 at 20:16