sitecore - Need a page that shows all articles that are published within a folder -
in sitecore, have folder full of articles. update these every quarter. have go page , manually link of these articles. want know if there way automatically list these articles on page. example, if folder has 10 articles, 9 publishable, main landing page show 9 published articles, not 10th one. make sense? sure can manually this, there has way make more automatic.
okay, let's go through in more detailed view - couple of notes mark's answer. in real production environment have @ least 2 servers - authoring (content master or cm) , content delivery (cd). youк sitecore desktop running on cm , publishes items cd database. have copy of website code running on cm (for @ least doing page previews) , on cd in fact website is.
items published come cd database having code above
var folder = sitecore.context.database.getitem("your-folder"); var children = folder.getchildren();
running on cd iterate through published items there (those 9 of 10).
same code running on cm (let's in page preview mode) show items (10 of them), unless have items in workflow assigned , explicitly check workflow status while iterating , process items in specific state (final instance). code might below:
iworkflow workflow = item.database.workflowprovider.getworkflow(item); if (workflow != null) { workflowstate state = workflow.getstates().firstordefault(state => state.displayname == workflowstatename); if (state != null) { // check state according requirements , append collection var children = folder.getchildren(); } }
Comments
Post a Comment