To avoid magic strings, and enforce type safety, instead of this
.DescendantsOfType("blogPost");
use the following
.Descendants<BlogPost>();
Type-safety means that if the class BlogPost is renamed, then you will get a compile-time exception rather than a runtime one. It's better that the developer finds the exception before the customer or site visitor sees it, right? A good adage is to avoid magic strings at all costs.
Getting descendants of type
Hi guys
Trying to list newest blogposts from all blog categories on my blogs frontpage.
Structure is like this
Blog
And so on. But I'm not sure how to get all the blog posts.
My view looks like this:
But I'm getting nothing back.
I tried removing almost everything and just get names, but still nothing.
Hope you guys can help me
Best
Henrik
Try this:
Perfect, Thomsen
Thanks a bunch!
To avoid magic strings, and enforce type safety, instead of this
use the following
Type-safety means that if the class BlogPost is renamed, then you will get a compile-time exception rather than a runtime one. It's better that the developer finds the exception before the customer or site visitor sees it, right? A good adage is to avoid magic strings at all costs.
Thanks a lot Chris :)
is working on a reply...