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 ?
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.
Try just setting them instead of adding new ones
ViewBag.Title= "My Title";
ViewBag.Description = "Description Text";
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 ?