34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
namespace Elternbeirat.Web.Services;
|
|
|
|
/// <summary>
|
|
/// A news post, read from a Markdown file in <c>Content/posts/</c>. Unlike a
|
|
/// <see cref="Page"/>, a post has a date and
|
|
/// is shown in a chronological list. The file name (without extension) is the
|
|
/// slug.
|
|
/// </summary>
|
|
public sealed class Post
|
|
{
|
|
/// <summary>
|
|
/// URL identifier of the post, taken from the file name without umlauts.
|
|
/// It appears in the route <c>/beitraege/{slug}</c>.
|
|
/// </summary>
|
|
public required string Slug { get; init; }
|
|
|
|
/// <summary>
|
|
/// Display title from the YAML front matter (<c>titel:</c>). Falls back to
|
|
/// the slug when no title is set.
|
|
/// </summary>
|
|
public required string Title { get; init; }
|
|
|
|
/// <summary>
|
|
/// Publication date from the front matter (<c>datum:</c>). Used to sort the
|
|
/// list newest first.
|
|
/// </summary>
|
|
public required DateOnly Date { get; init; }
|
|
|
|
/// <summary>
|
|
/// The post body rendered from Markdown to HTML (front matter excluded).
|
|
/// </summary>
|
|
public required string ContentHtml { get; init; }
|
|
}
|