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

Forums / Developing with Sitefinity / Retrieve blogpost info(meta description) from a page

Retrieve blogpost info(meta description) from a page

3 posts, 2 answered
  1. code777
    code777 avatar
    0 posts
    Registered:
    24 Feb 2013
    02 Sep
    Link to this post

    Hello,

    Could someone please assist me with trying to retrieve blogpost meta description from a bloppost detail page. When I navigate to my site's blog (http://mysite/blog). Then I proceed by clicking ony post (http://mysite/blog/somepost).

    I have the instance of the Page (System.Web.UI.Page) and PageSiteNode(Telerik.Sitefinity.Web.PageSiteNode).

    Every time I programmatically query the page for meta description i keep getting the page's meta description not the current blogpost's meta description.

    Moreover how do i check if the page contains a blogpost?

    Thanks in advance

    Answered
  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    02 Sep in reply to code777
    Link to this post

    You dont want to get an instance of the Page, you want to get an instance of BlogPost since a page can contain many widgets.

    So you should be able to query BlogPosts for "UrlName" which is the human readable slug (unique id) for the post.  In your case above .Where(x => x.UrlName == "somepost").

    Checking the page for controls is a bit more complicated, do you need this if the above works?

    Answered
  3. code777
    code777 avatar
    0 posts
    Registered:
    24 Feb 2013
    05 Sep in reply to Steve
    Link to this post
    Many thanks for your swift reply you've answer my question in many ways than you know. All I needed to do is to understand how Sitefinity API work a little better. I will mark this post as answer but If you don't mind another question. Do you know where in the documentation we can see properties for Sitefinity built-in Models(Telerik.Sitefinity.Model) like BlogPost. I know you can extend them but i would like to their original properties to memorise them so I won't always rely on intellisense.
3 posts, 2 answered