0
votes

Our website has been made so that the meta title only changes very little, and the meta description doesn't change at all on the different pages.

I'm very much a noob with Umbraco, so I don't know how to handle this problem:

This is the current template code:

@Model.Content.Name - Højskolen på Kalø

In each page, there is a tab called Meta Data , where I can add Meta Title, but the content is not displayed anywhere.

How can I pull that content and display in in the code above?

Do I need some info from the document type?

1
Have a look at how to render content (using properties) here: our.umbraco.com/documentation/Getting-Started/Design/…Jannik Anker
Right, so I've got some kind of solution: @(Model.Content.HasValue("metaTitle") ? Model.Content.GetPropertyValue("metaTitle") : Model.Content.Name) , but now I'm stuck with special characters like ÆØÅ not being displayed properly... I've set the <meta charset="UTF-8"> but I still get &#198;&#216;&#197;Zyberchief
Hm. Try wrapping the whole thing in a @Html.Raw(...) thing? Sounds strange though.Jannik Anker
Doesn't seem to work... but when I change the code to this: @(Model.Content.HasValue("metaTitle") ? Model.Content.GetPropertyValue("metaTitle") : Model.Content.Name) - slutning ÆØÅ I get this: meta titlen er her &#198;&#216;&#197; - slutning ÆØÅZyberchief

1 Answers

0
votes

You'll have to decode the special characters:

@HttpUtility.HtmlDecode(Model.Content.HasValue("metaTitle") ? Model.Content.GetPropertyValue("metaTitle") : Model.Content.Name) - slutning ÆØÅ

You may or may not have to wrap the above with Html.Raw, but that should work.