Exemple #1
0
        public void LoadDocuments()
        {
            Pages = IdentityCollection <Document> .Create(
                from file in Directory.EnumerateFiles(Paths["pages"], "*.*", SearchOption.AllDirectories).AsParallel()
                let fileId      = Path.GetFileNameWithoutExtension(file).Slugify()
                let relativeUrl = Path.Combine(Path.GetDirectoryName(file).Substring(Paths["pages"].Length), fileId + ".html").Replace('\\', '/')
                select new Document(Author, file, fileId, dateTimeFormat : DateFormat)
            {
                RelativeUrl       = "/" + relativeUrl,
                FullyQualifiedUrl = RootUrl.TrimEnd('/') + "/" + relativeUrl
            } into pages
                orderby pages.Date descending
                select pages);

            Posts = IdentityCollection <Document> .Create(
                from file in Directory.EnumerateFiles(Paths["posts"], "*.*", SearchOption.TopDirectoryOnly).AsParallel()
                let fileId      = Path.GetFileNameWithoutExtension(file).Slugify()
                let relativeUrl = Path.Combine(BlogPath, (fileId + (PrettyUrl ? "/index.html" : ".html"))).Replace('\\', '/')
                select new Document(Author, file, fileId, dateTimeFormat : DateFormat)
            {
                RelativeUrl       = "/" + relativeUrl,
                FullyQualifiedUrl = RootUrl.TrimEnd('/') + "/" + relativeUrl
            } into posts
                orderby posts.Date descending
                select posts);

            Theme.Load();
        }
Exemple #2
0
        public string ResolveLink(string uri)
        {
            if (!string.IsNullOrEmpty(uri) && !uri.StartsWith("http"))
            {
                uri = $"{RootUrl.TrimEnd('/')}/{uri}";
            }

            return(uri);
        }