+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Remove default empty SEO metatags

Remove default empty SEO metatags

5 posts, 0 answered
  1. Douglas
    Douglas avatar
    7 posts
    Registered:
    16 Dec 2015
    02 Feb
    Link to this post

    Hello all,

    I´m using Sitefinity version 8.2 and when the site loads I can see the meta tags like author, description etc, but depending on the page I need insert my own metatags, so when I insert this programatically I can see duplicate ones. How can I remove the empty and duplicated metatags ? From sitefinity ? Or inside my MVC controller ?

  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    02 Feb in reply to Douglas
    Link to this post
    How are you adding yours?
  3. Douglas
    Douglas avatar
    7 posts
    Registered:
    16 Dec 2015
    03 Feb in reply to Steve
    Link to this post

    Hey, Thanks for reply.

    Apparently the sitefinity insert the basic empty metatags in head section.  So using my MVC Controller I insert like this:

    var meta = new HtmlMeta();  // it works
    ((System.Web.UI.Page)context.CurrentHandler).Header.Controls.Remove(meta); // try to remove the duplicated ones, does not works

     meta.Attributes.Add("name", "Title"); // it works
     meta.Attributes.Add("content", "This comes from my dynamic module");// it works

     ((System.Web.UI.Page)context.CurrentHandler).Header.Controls.Add(meta);// it works

    When the view finishes render I can see the empty basic and then the mine.

     

  4. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    03 Feb in reply to Douglas
    Link to this post

    Try just setting them instead of adding new ones

    ViewBag.Title= "My Title";

    ViewBag.Description = "Description Text";

  5. Douglas
    Douglas avatar
    7 posts
    Registered:
    16 Dec 2015
    03 Feb in reply to Steve
    Link to this post

    Ok. I already tried use ViewBag but not worked for me.

    The only way that I can do this work is using the showed code above,

    It is possible to have another solution ?

    Thanks.

     

5 posts, 0 answered