I have scoured Google, but all the answers seem to be from older versions of Umbraco. I want to show 4 or 5 post excerpts on my homepage. I can get results for the "ArticulateRichText" type using the query builder, but when I try to access the properties in that collection like "Excerpt" and "PublishedDate", I get error messages about IPublishedContent and other things that I don't understand.
Here is my attempted code:
@{
var blog = Umbraco.Content(Guid.Parse("208fb5bd-5f50-409f-bd7d-85357a1dc707")).ChildrenOfType("ArticulateRichText").Where(x => x.IsVisible()).Take(5);
foreach(var post in blog) {
<article>
@*<time>@post.PublishedDate.ToString("MM/dd/yy")</time>*@
<p><a href="@post.Url">@post.Name</a><br>
@*@post.Excerpt*@</p>
</article>
}
}
The post URL and name work fine, but if I uncomment the date or excerpt lines, I get the following error:
System.Web.HttpCompileException (0x80004005): C:\home\site\wwwroot\Views\Home.cshtml(91): error CS1061: 'IPublishedContent' does not contain a definition for 'PublishedDate' and no accessible extension method 'PublishedDate' accepting a first argument of type 'IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
If anyone can help me solve this I would greatly appreciate it.
(If you tried to move blog under the home node, you need to edit the permissions on the home document type to allow children of the gallery type.
You can find this in Settings > Document types > Home > permissions otherwise it will show error like "The current node is not allowed under the chosen node because of its type")
I saw that thread already, I have no idea which solution is the right one there. I tried the partial someone posted near the top and got "The type name 'Models' does not exist in the type 'Articulate'".
How do I show Articulate posts on my homepage?
I have scoured Google, but all the answers seem to be from older versions of Umbraco. I want to show 4 or 5 post excerpts on my homepage. I can get results for the "ArticulateRichText" type using the query builder, but when I try to access the properties in that collection like "Excerpt" and "PublishedDate", I get error messages about IPublishedContent and other things that I don't understand.
Here is my attempted code:
The post URL and name work fine, but if I uncomment the date or excerpt lines, I get the following error:
If anyone can help me solve this I would greatly appreciate it.
Hello Josh,
Check this it can help you
https://our.umbraco.com/packages/starter-kits/articulate/discussions/55577-Displaying-Articulate-blog-posts-on-my-homepage
(If you tried to move blog under the home node, you need to edit the permissions on the home document type to allow children of the gallery type. You can find this in Settings > Document types > Home > permissions otherwise it will show error like "The current node is not allowed under the chosen node because of its type")
I saw that thread already, I have no idea which solution is the right one there. I tried the partial someone posted near the top and got "The type name 'Models' does not exist in the type 'Articulate'".
I was finally able to get the posts to show. Thanks for the link.
is working on a reply...