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
I want to add a canonical URL to my master page which is coming from the document type. So on my document type I have a node picker where I can select a page from the content tree. I want to render this URL in the head section of my master template. Is this possible?
I've tried many things, the most obvious ones didn't work:
var canonicalUrl = Model.Value("metaCanonical").Url
IPublishedContent canonicalUrl = Model.Value("metaCanonical")
I'm aware that the master page can't inherit any specific model, this is what my master template inherits:
Any suggestions as to how I can access the page URL from the node picker? Thanks in advance!
You can achieve this using standard MVC sections.
In the master page place this in the head section:
Then in your tempates which inherits this master page place this:
You can name the section as you wish (not necessary to be "Head").
Thank you for your suggestion, I think we'll go with this solution. We'd need to add the section to every page, but I think it's the only way to get it working. Thanks alot!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted