Ejemplo n.º 1
0
        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"
            });
        }
Ejemplo n.º 2
0
Archivo: Site.cs Proyecto: ili/website
        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"
            };
        }