Created
October 27, 2017 10:03
-
-
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.
This file contains 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
@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