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

Forums / Bugs & Issues / Add Head Tags

Add Head Tags

2 posts, 0 answered
  1. Kieran
    Kieran avatar
    56 posts
    Registered:
    14 Aug 2008
    17 May 2010
    Link to this post
    Hi,

    In the "More Options"  in the Page Property tab I am using the add head tags section.

    Is it possible to add extra tag values to the meta drop down list.

    Eg. If I wanted to add a "review date" tag.


    Cheers
    Kieran
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    18 May 2010
    Link to this post
    Hi Kieran,

    This part of the CMS is not meant for extensions. However you create a custom control which when added to the page can be configurred to add such a meta tag control. Bellow is the sample source of the control:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Cms.Web.UI;
    using System.ComponentModel;
    using System.Web.UI.HtmlControls;
     
    namespace Sitefinity.Samples.WebControls
    {
        /// <summary>
        /// Summary description for AddHeaderTag
        /// </summary>
        public class AddHeaderTag: SimpleControl
        {
            #region Enumerators
     
            public enum MetaTagName { ReviewDate, Other };
             
            #endregion
     
            #region Public properties
     
            [Category("Attributes")]
            public MetaTagName Name { get; set; }
             
            [Category("Attributes")]
            public string Content
            {
                get
                {
                    return this.content;
                }
                set
                {
                    this.content = value;
                }
            }
     
            [Category("Attributes")]
            public string Scheme
            {
                get
                {
                    return this.scheme;
                }
                set
                {
                    this.scheme = value;
                }
            }
            #endregion
     
            #region Method overrides
     
            protected override void  InitializeControls(System.Web.UI.Control controlContainer)
            {
                base.InitializeControls(controlContainer);
                if(this.Page!=null && !DesignMode){
                HtmlMeta newMeataControl = new HtmlMeta();
                if (Name != null)
                {
                    switch (Name)
                    {
                        case MetaTagName.ReviewDate: newMeataControl.Name = "review date"; break;
                        case MetaTagName.Other: newMeataControl.Name = "other"; break;
                    }
                }
                if(!String.IsNullOrEmpty(Content))
                    newMeataControl.Content=Content;
                if(!String.IsNullOrEmpty(scheme))
                    newMeataControl.Scheme= Scheme;
                this.Page.Header.Controls.Add(newMeataControl);}
            }
     
            #endregion
     
            #region Private fields
             
            private string content;
            private string scheme;
     
            #endregion
        }
    }


    Kind regards,
    Radoslav Georgiev
    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.
2 posts, 0 answered