Skip to content

Instantly share code, notes, and snippets.

@ps-team
Created October 27, 2017 10:03
Show Gist options
  • Save ps-team/d4b5c9385a17f6a57dde3838c9b3e4bc to your computer and use it in GitHub Desktop.
Save ps-team/d4b5c9385a17f6a57dde3838c9b3e4bc to your computer and use it in GitHub Desktop.
List of news categories that link through to the listing template under the current top folder.
@using Contensis.Framework.Web
@using Contensis.Framework.Web.Search
@{
// This could use the GetByKey() method instead.
var node = CurrentContext.Taxonomy.GetByPath("StructuredContent/newscategories/", TaxonomySortOrder.Alphabetical);
var listingPath = "";
string topFolderId = CurrentNode.Data.Property_TopFolderId.ToString();
var query = Query.Where("Property_TopFolderId").IsEqualTo(topFolderId).And("SC_T_ID").IsEqualTo("-154");
var sectionNewsNode = new NodeFinder().Find(query);
if(sectionNewsNode.Count > 0) {
listingPath = sectionNewsNode[0].Path;
}else{
listingPath = "/test/news/news-listings.aspx";
}
}
<ul class="sys_simpleListMenu">
@foreach (var childNode in node.Children)
{
<li><a href="@[email protected]">@childNode.Value</a></li>
}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment