Last active
June 13, 2020 19:23
-
-
Save y0mbo/797bc8bede070477ae8b616015074c71 to your computer and use it in GitHub Desktop.
Umbraco 8 - Articulate - get the top newest posts with a given tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@* 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