@inherits StatiqRazorPage<IEnumerable<IDocument>>
@foreach (var post in Model)
{
    <div>
        <h3 class="mb-0"><a href="@Context.GetLink(post)">@post.GetString("Title")</a></h3>
        @{
            var author = post.GetString("Author");
            var published = post.GetDateTime("Published");
            var category = post.GetString("Category");
        }
        <div class="mt-2 font-light text-xs md:text-sm">
            <span>Posted </span>
            @if (published != default(DateTime)) {
                <span>@published.ToLongDateString() </span>
            }
            @if (author != null) {
                <span>by @author </span>
            }
            @if (category != null) {
                var categoryUrl = @Context.GetLink($"blog/{NormalizedPath.OptimizeFileName(category)}/index.html");
                <span>
                    to <a class="text-blue-800 underline" href="@categoryUrl">
                        @category
                    </a>
                </span>
            }

        </div>
        <article>
            @Html.Raw(@post.GetString("Excerpt"))
        </article>
    </div>
}