Forums Home / Developer Network / Forums / Sitefinity 3.x: Suggestions > Meta tags for SEO Not answered Meta tags for SEO Feed from this thread Devin Intermediate Posted on Jan 8, 2010 (permalink) Hi I'd like to be able to organize my head tags like this: <head> <title>title</title> <meta name="Description" content="..." /> <meta name="Keywords" content="..." /> ... </head> The key is that I would also like to be able to edit Description and Keywords for each individual page in the CMS. I think this would be very useful for SEO purposes. I think this is something that all Sitefinity users can benefit from. Thanks, Devin Reply Ivan Dimitrov Ivan Dimitrov Posted on Jan 10, 2010 (permalink) Hi Devin, The key is that I would also like to be able to edit Description and Keywords for each individual page in the CMS. You can do this through Sitefinity backend. Each page has a section under More Options called - Add Head tags(For all languages) Another option is using a simple user control and standard ASP.NET class HtmlMeta sample code: public partial class Sitefinity_UserControls_MetaTagsControl : System.Web.UI.UserControl { #region Public Properties public string MetaTagName { get { return metaTagName; } set { metaTagName = value; } } public string MetaTagContent { get { return metaTagContent; } set { metaTagContent = value; } } #endregion protected void Page_Load(object sender, EventArgs e) { HtmlMeta metaTag = new HtmlMeta(); metaTag.Name = this.MetaTagName; metaTag.Content = this.MetaTagContent; this.Page.Header.Controls.Add(metaTag); } private string metaTagName; private string metaTagContent; } Sincerely yours, Ivan Dimitrov the Telerik team Instantly find answers to your questions on the new Telerik Support Portal. Watch a video on how to optimize your support resource searches and check out more tips on the blogs. Reply David Pearson Posted on Mar 8, 2010 (permalink) Hi Ivan, Will this override the Description and keyword in SiteFinity. I am researching an ideal to dynamically recreate the values from a database on PageLoad where we random select and reorder keywords depending on which page is being displayed. Thanks, David Reply Ivan Dimitrov Ivan Dimitrov Posted on Mar 8, 2010 (permalink) Hello David Pearson, This will not override the default keys. If you want to remove any key you can use Page.Header.Controls.Remove() Regards, Ivan Dimitrov the Telerik team Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items. Reply David Pearson Posted on Mar 8, 2010 (permalink) Thanks Ivan for the quick answer, I will get the work writing the back end module then start teh front end. David Reply Devin Intermediate Posted on Jun 14, 2010 (permalink) Hi, This code will remove any existing meta tags that match the Name and add its own underneath the title tag. protected void Page_Load(object sender, EventArgs e) { HtmlMeta metaTag = new HtmlMeta(); metaTag.Name = this.MetaTagName; metaTag.Content = this.MetaTagContent; for (int i = 0; i < Page.Header.Controls.Count; i++) { Control hm1 = Page.Header.Controls[i]; if (hm1 is HtmlMeta && (((HtmlMeta)hm1).Name.ToLower() == this.MetaTagName.ToLower())) { Page.Header.Controls.Remove(hm1); } } this.Page.Header.Controls.AddAt(1, metaTag); } Thanks, Devin Reply Allan Cadenilla Posted on Aug 18, 2010 (permalink) I accomplish this with the following. 1) I created a custom class that inherited Telerik.Cms.Web.InternalPage 2) Override OnPreRender protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); int idx = 0; HtmlTitle title = null; HtmlMeta keywords = null, description = null; foreach (Control c in this.Header.Controls) { HtmlTitle t = c as HtmlTitle; if (t != null) { title = t; } HtmlMeta m = c as HtmlMeta; if (m != null) { switch (m.Name.ToLower()) { case "keywords": keywords = m; break; case "description": description = m; break; } } } if (title != null) { this.Header.Controls.Remove(title); this.Header.Controls.AddAt(idx++, title); } if (keywords != null) { this.Header.Controls.Remove(keywords); this.Header.Controls.AddAt(idx++, keywords); } if (description != null) { this.Header.Controls.Remove(description); this.Header.Controls.AddAt(idx++, description); } } 3) Go to ~/Sitefinity/CMSEntryPoint and substitute the inherits attribute with the custom class Reply Home / Developer Network / Forums / Sitefinity 3.x: Suggestions > Meta tags for SEO