Try Now
More in this section

Forums / Developing with Sitefinity / Dynamic Meta Description content

Dynamic Meta Description content

4 posts, 0 answered
  1. David
    David avatar
    10 posts
    20 Jul 2014
    16 Dec 2014
    Link to this post

    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.



  2. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    26 Mar 2015
    18 Dec 2014
    Link to this post
    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
  3. Chris
    Chris avatar
    1 posts
    08 Apr 2014
    20 Jan 2015 in reply to Ivan D. Dimitrov
    Link to this post
    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.
  4. David
    David avatar
    5 posts
    28 Mar 2013
    08 Jul
    Link to this post

    I can confirm that above solution work fine from MVC feather widgets.

4 posts, 0 answered