More in this section

Forums / Developing with Sitefinity / Head Meta Tag Names

Head Meta Tag Names

9 posts, 0 answered
  1. Pamela Thalacker
    Pamela Thalacker avatar
    14 posts
    Registered:
    25 Feb 2010
    31 May 2010
    Link to this post
    It appears that if you want to add meta tags to a page in its properties, you can only select from pre-defined tag names.  What populates the name drop-down list in the Page Properties? How can I add some new tag names?

    pthalacker
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    31 May 2010
    Link to this post
    Hi Pamela Thalacker,

    It is not possible to extend the page properties in 3.x edition. You can create a custom control, like this one shown below to add all kind of tags to your pages.

    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;
    }


    Greetings,
    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.
  3. Pamela Thalacker
    Pamela Thalacker avatar
    14 posts
    Registered:
    25 Feb 2010
    31 May 2010
    Link to this post
    I am not sure what version the web site is deployed on, but there are some custom meta tag names in the user interface of the current site.  How did they get there?

    pthalacker
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    31 May 2010
    Link to this post
    Hello Pamela Thalacker,

    If there is a custom data layer used to persist these properties as a metatags this could happen, but our HeadTags classes cannot be overridden.

    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.
  5. Pamela Thalacker
    Pamela Thalacker avatar
    14 posts
    Registered:
    25 Feb 2010
    31 May 2010
    Link to this post
    So if I want to add 5 metatags to a page I would put 5 of these on the page and change their name and content values in the page content editor?

    pthalacker
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    31 May 2010
    Link to this post
    Hi Pamela Thalacker,

    You could put one user control, but with multiple instance of HtmlMeta .

    HtmlMeta metaTag = new HtmlMeta();
    metaTag.Name = this.MetaTagName;
    metaTag.Content = this.MetaTagContent;
    this.Page.Header.Controls.Add(metaTag);
     
    HtmlMeta metaTag1 = new HtmlMeta();
    metaTag1.Name = this.MetaTagName1;
    metaTag1.Content = this.MetaTagContent1;
    this.Page.Header.Controls.Add(metaTag1);
     
     
    HtmlMeta metaTag2 = new HtmlMeta();
    metaTag2.Name = this.MetaTagName2;
    metaTag2.Content = this.MetaTagContent2;
    this.Page.Header.Controls.Add(metaTag2);

    You can find more detailed information at HtmlMeta Class - .NET Framework Class Library

    Greetings,
    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.
  7. Pamela Thalacker
    Pamela Thalacker avatar
    14 posts
    Registered:
    25 Feb 2010
    31 May 2010
    Link to this post
    Does it have to be a user control?  Can't it just be a plain old control?

    pthalacker
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    31 May 2010
    Link to this post
    Hi Pamela Thalacker,

    It could be a user or a custom control.

    Kind 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.
  9. Pamela Thalacker
    Pamela Thalacker avatar
    14 posts
    Registered:
    25 Feb 2010
    31 May 2010
    Link to this post
    Is there a way to add default values.  So the name and content would be pre-populated for the person editing the page, but they could still override them when they were editing the control's properties?

    pthalacker
Register for webinar
9 posts, 0 answered