Remove default empty SEO metatags

Posted by Community Admin on 03-Aug-2018 15:02

Remove default empty SEO metatags

All Replies

Posted by Community Admin on 02-Feb-2016 00:00

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 ?

Posted by Community Admin on 02-Feb-2016 00:00

How are you adding yours?

Posted by Community Admin on 03-Feb-2016 00:00

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.

 

Posted by Community Admin on 03-Feb-2016 00:00

Try just setting them instead of adding new ones

ViewBag.Title= "My Title";

ViewBag.Description = "Description Text";

Posted by Community Admin on 03-Feb-2016 00:00

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.

 

This thread is closed