Files
Elternbeirat/Elternbeirat.Web/Features/Posts/PostList.razor
T

38 lines
812 B
Plaintext

@page "/posts"
@{
// Heading and intro come from the "posts" page record; fall back to a sensible
// default only if that record is missing, so the page still renders.
var title = _page?.Title ?? "Beiträge";
}
<PageTitle>@title</PageTitle>
<h1>@title</h1>
@if (_page is not null && !string.IsNullOrWhiteSpace(_page.Body))
{
<article>@Body</article>
}
@if (_unavailable)
{
<p>Die Beiträge sind gerade nicht erreichbar. Bitte später erneut versuchen.</p>
}
else if (_posts.Count == 0)
{
<p>Zurzeit gibt es keine Beiträge.</p>
}
else
{
<ul class="post-list">
@foreach (var post in _posts)
{
<li>
<a href="@($"/posts/{post.Slug}")">@post.Title</a>
<PostDate Value="post.Date" />
</li>
}
</ul>
}