public void OnGet() { var blogPath = Path.Combine(_env.WebRootPath, BlogRelativePath); var loader = new BlogPostLoader(_env, Url); Index = loader.LoadIndex(blogPath); }
public async Task OnGet(string url) { var blogPath = Path.Combine(_env.WebRootPath, BlogRelativePath); var loader = new BlogPostLoader(_env, Url); var index = loader.LoadIndex(blogPath); RecentPosts = index.Take(10); var articlePath = string.IsNullOrWhiteSpace(url) ? index.FirstOrDefault()?.Path : NormalizeMarkdownPath(Path.Combine(blogPath, url)); if (!string.IsNullOrWhiteSpace(articlePath) && System.IO.File.Exists(articlePath)) { var selected = index.FirstOrDefault(x => x.Path == articlePath); if (selected is object) { selected.IsSelected = true; } Article = await loader.LoadArticle(articlePath); } }