Retrieve blogpost info(meta description) from a page

Posted by Community Admin on 04-Aug-2018 10:07

Retrieve blogpost info(meta description) from a page

All Replies

Posted by Community Admin on 02-Sep-2016 00:00

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

Posted by Community Admin on 02-Sep-2016 00:00

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?

Posted by Community Admin on 05-Sep-2016 00:00

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.

This thread is closed