private MarkdownPostViewModel GetPost(string filePath, string articleName = null)
        {
            var model = new MarkdownPostViewModel();

            if (_fileSystem.FileExists(filePath))
            {
                var contents = string.Empty;
                using (var fileStream = System.IO.File.Open(filePath, FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read))
                    using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
                    {
                        contents = streamReader.ReadToEnd();
                    }

                model.UrlPath = GetPostMetadataValue("Url", contents);
                if (string.IsNullOrEmpty(model.UrlPath))
                {
                    model.UrlPath = GetUrl(filePath, articleName);
                }
                model.Title     = GetPostMetadataValue("Title", contents);
                model.Author    = GetPostMetadataValue("Author", contents);
                model.Keywords  = GetPostMetadataValue("Keywords", contents);
                model.Summary   = GetPostMetadataValue("Summary", contents);
                model.Tags      = GetPostMetadataValue("Tags", contents);
                model.Published = DateTime.ParseExact(GetPostMetadataValue("Published", contents), "yyyyMMdd", CultureInfo.InvariantCulture);
                model.Post      = Markdown.ToHtml(contents.Remove(0, contents.IndexOf("---") + 3), MarkdownPipeline);
                model.Image     = Markdown.ToHtml(GetPostMetadataValue("Image", contents), MarkdownPipeline);
            }

            return(model);
        }
        private MarkdownPostViewModel GetPost(string filePath, string articleName = null)
        {
            var model = new MarkdownPostViewModel();
            if (_fileSystem.FileExists(filePath))
            {
                var contents = string.Empty;
                using (var fileStream = System.IO.File.Open(filePath, FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read))
                using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
                {
                    contents = streamReader.ReadToEnd();
                }

                model.UrlPath = GetUrl(filePath, articleName);
                model.Title = GetPostMetadataValue("Title", contents);
                model.Author = GetPostMetadataValue("Author", contents);
                model.Keywords = GetPostMetadataValue("Keywords", contents);
                model.Summary = GetPostMetadataValue("Summary", contents);
                model.Tags = GetPostMetadataValue("Tags", contents);
                model.Published = DateTime.ParseExact(GetPostMetadataValue("Published", contents), "yyyyMMdd", CultureInfo.InvariantCulture);
                model.Post = Markdig.Markdown.ToHtml(contents.Remove(0, contents.IndexOf("---") + 3), MarkdownPipeline);
            }

            return model;
        }