A have three custom classifications (AGLS terms) that I want to be able to select per page and for those classifications selected be displayed as a metatag for that page.
I can add a custom field on the page which allows me to select the tags, but how do I automatically apply this as a custom metatag in the template?
E.g. the meta added in the HTML of the page:
<meta name="AGLSTERMS.documentType" scheme="AGLSTERMS.agls-document" content="<inserted tags as selected per page here>" />
Progress Sitefinity CMS 11.2 Online Marketing Edition
Build version:11.2.6900.0
<meta name="AGLSTERMS.documentType" scheme="AGLSTERMS.agls-document" content="policy statement" /> |
Any ideas?
Here is some code that will get you most of the way. You will need to modify it to get scheme attribute in there. The OnPagePreRenderCompleteEventHandler(IPagePreRenderCompleteEvent evt) will be called on each page render then look for the fields on the page to add the value as a metafield. To register the page render event you can do it in your Global.asax or in a separate assembly.
Sitefinity docs reference for events www.progress.com/.../for-developers-pages-events
Code: