Example #1
0
        public static LayoutFileCollection Create(IEnumerable <LayoutFile> layouts)
        {
            var collection = new LayoutFileCollection();

            foreach (var layout in layouts)
            {
                collection.Add(layout);
            }

            return(collection);
        }
Example #2
0
        public static Site Load(SiteConfig config, IEnumerable <string> renderedExtensions, Site parent = null)
        {
            var site = new Site();

            site.Author        = config.Author;
            site.DocumentsPath = config.DocumentsPath;
            site.FilesPath     = config.FilesPath;
            site.LayoutsPath   = config.LayoutsPath;
            site.OutputPath    = config.OutputPath;
            site.Parent        = parent;
            site.TimeZone      = config.TimeZone;
            site.Url           = config.Url.EnsureEndsWith("/");
            site.RootUrl       = config.RootUrl.EnsureEndsWith("/");
            site.Metadata      = new MetadataCollection(config.Metadata);

            site.Documents = LoadDocuments(site.DocumentsPath, site.OutputPath, site.Url, site.RootUrl, site.Author, renderedExtensions).ToList();
            site.Files     = LoadFiles(site.FilesPath, site.OutputPath, site.Url, site.RootUrl).ToList();

            var layoutList = LoadLayouts(site.LayoutsPath);

            site.Layouts = LayoutFileCollection.Create(layoutList);

            return(site);
        }