private static List <BreadItem> processItems(List <SitemapMeta> pages, PageQuery query) { var items = new List <BreadItem>(); foreach (var page in pages) { if (page.index == query.index) { items.Add(new BreadItem() { url = page.url, title = page.title }); if (page.child != null) { var child_items = processItems(page.child, query); if (child_items.Count > 0) { foreach (var item in child_items) { items.Add(item); } } } } else if (page.order == query.order && query.order != "") { items.Add(new BreadItem() { url = page.url, title = page.title }); if (page.child != null) { var child_items = processItems(page.child, query); if (child_items.Count > 0) { foreach (var item in child_items) { items.Add(item); } } } } else if (page.date == query.filter && query.filter != "") { items.Add(new BreadItem() { url = page.url, title = page.title }); if (page.child != null) { var child_items = processItems(page.child, query); if (child_items.Count > 0) { foreach (var item in child_items) { items.Add(item); } } } } } return(items); }
private static Meta processMeta(List <Page> pages, PageQuery query) { var meta = new Meta(); foreach (var page in pages) { if (page.index == query.index) { if (page.date == query.filter && query.filter != "") { if (page.child != null) { return(processMeta(page.child, query)); } else { meta.title = page.title; meta.description = page.description; meta.keywords = page.keywords; meta.imageurl = page.imageurl; return(meta); } } else if (page.order == query.order && query.order != "") { if (page.child != null && query.filter != "") { return(processMeta(page.child, query)); } else { meta.title = page.title; meta.description = page.description; meta.keywords = page.keywords; meta.imageurl = page.imageurl; return(meta); } } else if (page.order == null && page.date == null) { if (page.child != null) { return(processMeta(page.child, query)); } else { meta.title = page.title; meta.description = page.description; meta.keywords = page.keywords; meta.imageurl = page.imageurl; return(meta); } } } /*else if (page.child != null) * { * return processMeta(page.child, query); * } * else * { * meta.title = page.title; * meta.description = page.description; * meta.keywords = page.keywords; * meta.imageurl = page.imageurl; * return meta; * }*/ } return(meta); }