public static CollectionMetadata GetCollectionMetadata(string name) { var collections = _site.ContainsKey("collections") ? _site["collections"] as Dictionary <string, object> : null; if (collections != null) { // collections are defined var collection = collections.ContainsKey(name) ? collections[name] as Dictionary <string, object> : null; if (collection != null) { var cm = new CollectionMetadata { Name = name }; if (collection.ContainsKey("output")) { cm.Output = (bool)collection["output"]; } if (collection.ContainsKey("permalink")) { cm.Permalink = (string)collection["permalink"]; } return(cm); } } return(new CollectionMetadata { Name = name, Output = true, Permalink = "/:year/:month/:day/:title" }); }
public static CollectionMetadata GetCollectionMetadata(string name) { var collections = _site.ContainsKey("collections") ? _site["collections"] as Dictionary<string, object> : null; if (collections != null) { // collections are defined var collection = collections.ContainsKey(name) ? collections[name] as Dictionary<string, object> : null; if (collection != null) { var cm = new CollectionMetadata { Name = name }; if (collection.ContainsKey("output")) { cm.Output = (bool)collection["output"]; } if (collection.ContainsKey("permalink")) { cm.Permalink = (string)collection["permalink"]; } return cm; } } return new CollectionMetadata { Name = name, Output = true, Permalink = "/:year/:month/:day/:title" }; }