Dynamic Meta Description content - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Dynamic Meta Description content

  • Dynamic Meta Description content
  • Hello All,

    Today, I have some of problems when working with <meta> tags in Sitefinity 7.2

    I created one widget by MVC and register it to toolbox. And then I created a page, In this page I drag this Widget, so when page open need to set <Meta> content dynamic when page open.


    Please helps with any solutions.

    Best Regards.



  • Hi David,

    Thank you for contacting us.

    The way you can alter the page head in order to add meta tags there for Sitefinity MVC is by accessing the page instance in your MVC controller by calling it through the current handler. The code you should use is something like the following:

    HtmlMeta hm = new HtmlMeta();
    hm.Attributes.Add("name", "description");
    hm.Content = "your meta content";

    I hope this helps. Let me know if there is anything else I can do for you.

    Ivan D. Dimitrov
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
  • The answer does not work. The CurrentHandler in the controller of a widget is null. So attempting to get the page instance throws a null reference exception. Is there something else that needs to be done? Also, using statements are helpful.
  • I can confirm that above solution work fine from MVC feather widgets.