Skip to content

Instantly share code, notes, and snippets.

@y0mbo
Last active June 13, 2020 19:23
Show Gist options
  • Save y0mbo/797bc8bede070477ae8b616015074c71 to your computer and use it in GitHub Desktop.
Save y0mbo/797bc8bede070477ae8b616015074c71 to your computer and use it in GitHub Desktop.
Umbraco 8 - Articulate - get the top newest posts with a given tag
@* Umbraco 8 *@
@inherits Umbraco.Web.Mvc.UmbracoViewPage
@using Articulate;
@using Articulate.Models;
@{
var root = @Model.AncestorOrSelf(1);
// blog posts with tags that match the industry name
var allBlogPosts = root.ChildrenOfType("Articulate").First().ChildrenOfType("ArticulateArchive").First();
ListModel archive = new ListModel(allBlogPosts);
var blogPosts = archive.Posts.Where(post => post.Tags.Any(tag => tag == Model.Name)).OrderByDescending(post => post.PublishedDate).Take(6);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment