Try Now
More in this section

Forums / Developing with Sitefinity / Adding Meta Tags to the Blog

Adding Meta Tags to the Blog

2 posts, 0 answered
  1. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    04 May 2005
    17 Mar 2010
    Link to this post
    My users would like to be able to add meta tags to specific blog posts like the following:

    <meta id="MetaDescription" name="description" content="HubSpot Internet Marketing Blog - Award winning blog on Internet marketing, search engine optimization, inbound marketing, analytics, best practices.">

    What is the best way to provide this functionality? I was thinking I needed to customize the new blog post control and the blog post edit control.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    17 Mar 2010
    Link to this post
    Hi Connections Academy Developer,

    MetaTags are declared for a provider ( say Blogs). You could get separate metatags for a give blog by filtering the visibility of the key depending on the post ParentID. Each post is an IContent object that has a parent Each parent is IBlog object. You could map the external templates PostNew and PostEdit and depending on the parent filter the metakeys. By doing so you could achieve separate metakeys for each blog.

    sample ( you should add this code to PostNew and PostEdit templates)

    if (!String.IsNullOrEmpty(HttpContext.Current.Request.QueryString["ParentId"])
          Guid blogID = new Guid(HttpContext.Current.Request.QueryString["ParentId"].ToString());
          var manager = new BlogManager("Blogs");
          IBlog blog = manager.GetBlog(blogID);
          if(blog.Name == "SomeName")
           // show/hide controls from the templates

    Best wishes,
    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.
2 posts, 0 answered