@page @model DysonNetwork.Zone.Pages.PostsModel @{ Layout = "_LayoutContained"; const string defaultAvatar = "https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mp"; var pageTitle = "Posts"; var pageDescription = "A collection of posts."; string? ogImageUrl = null; var canonicalUrl = $"{Request.Scheme}://{Request.Host}{Request.Path}{Request.QueryString}"; var siteName = Model.Publisher?.Nick ?? Model.Publisher?.Name ?? "Solar Network"; if (Model.Publisher != null) { pageTitle = $"Posts by {Model.Publisher.Nick ?? Model.Publisher.Name}"; pageDescription = $"Browse posts written by {Model.Publisher.Nick ?? Model.Publisher.Name}."; if (Model.Publisher.Background != null) { ogImageUrl = $"{Request.Scheme}://{Request.Host}/drive/files/{Model.Publisher.Background.Id}"; } } } @section Head { @pageTitle - @siteName @if (!string.IsNullOrEmpty(ogImageUrl)) { } @if (!string.IsNullOrEmpty(ogImageUrl)) { } }

Posts

@if (Model.Posts.Any()) {
@foreach (var post in Model.Posts) {
@if (!string.IsNullOrWhiteSpace(post.Title) || !string.IsNullOrWhiteSpace(post.Description)) {
@if (!string.IsNullOrWhiteSpace(post.Title)) {

@post.Title

} @if (!string.IsNullOrWhiteSpace(post.Description)) {

@post.Description

}
}

@Html.Raw(post.Content)

@if (post.Attachments.Any()) {
@foreach (var attachment in post.Attachments) {
@if (attachment.MimeType!.StartsWith("image")) {
@attachment.Name
} else if (attachment.MimeType!.StartsWith("video")) { } else if (attachment.MimeType!.StartsWith("audio")) { } else { @attachment.Name }
}
} @if (post.Categories.Any() || post.Tags.Any()) {
@foreach (var category in post.Categories) { @(!string.IsNullOrEmpty(category.Name) ? category.Name : category.Slug) } @foreach (var tag in post.Tags) { @(!string.IsNullOrEmpty(tag.Name) ? tag.Name : tag.Slug) }
}
Posted on @post.CreatedAt.ToDateTimeOffset().ToString("yyyy-MM-dd")
}
} else {

No posts found.

} @if (Model.TotalPages > 1) {
@for (var idx = 1; idx <= Model.TotalPages; idx++) { var pageIdx = idx; @pageIdx }
}
@if (Model.Publisher != null) {
@if (Model.Publisher!.Background != null) {
Background
}
Avatar

@Model.Publisher.Nick @@@Model.Publisher.Name

@if (!string.IsNullOrWhiteSpace(Model.Publisher.Bio)) {

@Model.Publisher.Bio

}
}