Add events calendar with ICS feed and switch content naming to English
This commit is contained in:
1 parent
f24a4e73a2
commit
9459d2aeaa
28 files changed
+607
-29
No files matched your search
@@ -4,7 +4,7 @@ using Markdig;
|
||||
namespace Elternbeirat.Web.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Reads the news posts from <c>Content/beitraege/*.md</c>, renders them to HTML
|
||||
/// Reads the news posts from <c>Content/posts/*.md</c>, renders them to HTML
|
||||
/// once at startup and keeps them in memory, sorted newest first. Registered as
|
||||
/// a singleton because the content lives in the image and does not change at
|
||||
/// runtime.
|
||||
@@ -15,7 +15,7 @@ public sealed class PostService
|
||||
private readonly IReadOnlyDictionary<string, Post> _postsBySlug;
|
||||
|
||||
/// <summary>
|
||||
/// Reads every Markdown post from the <c>Content/beitraege</c> directory
|
||||
/// Reads every Markdown post from the <c>Content/posts</c> directory
|
||||
/// below the application root and caches it.
|
||||
/// </summary>
|
||||
public PostService(IWebHostEnvironment environment)
|
||||
@@ -24,7 +24,7 @@ public sealed class PostService
|
||||
.UseYamlFrontMatter()
|
||||
.Build();
|
||||
|
||||
var directory = Path.Combine(environment.ContentRootPath, "Content", "beitraege");
|
||||
var directory = Path.Combine(environment.ContentRootPath, "Content", "posts");
|
||||
var posts = new List<Post>();
|
||||
|
||||
if (Directory.Exists(directory))
|
||||
@@ -64,8 +64,8 @@ public sealed class PostService
|
||||
var source = File.ReadAllText(path);
|
||||
|
||||
var document = Markdown.Parse(source, pipeline);
|
||||
var title = FrontMatter.Read("titel", document, source) ?? slug;
|
||||
var date = ParseDate(FrontMatter.Read("datum", document, source));
|
||||
var title = FrontMatter.Read("title", document, source) ?? slug;
|
||||
var date = ParseDate(FrontMatter.Read("date", document, source));
|
||||
var html = Markdown.ToHtml(source, pipeline);
|
||||
|
||||
return new Post { Slug = slug, Title = title, Date = date, ContentHtml = html };
|
||||
|
||||
Reference in new issue
Block a user