+ @(Model.Post.Title ?? "Post Details") +
+ @if (!string.IsNullOrWhiteSpace(Model.Post.Description)) + { +@Model.Post.Description
+ } + +
+
diff --git a/DysonNetwork.Zone/Pages/Posts/Details.cshtml.cs b/DysonNetwork.Zone/Pages/Posts/Details.cshtml.cs
index ec9a978..a3aaac0 100644
--- a/DysonNetwork.Zone/Pages/Posts/Details.cshtml.cs
+++ b/DysonNetwork.Zone/Pages/Posts/Details.cshtml.cs
@@ -1,3 +1,4 @@
+using Markdig;
using DysonNetwork.Shared.Models;
using DysonNetwork.Shared.Proto;
using DysonNetwork.Zone.Publication;
@@ -31,6 +32,10 @@ public class DetailsModel(PostService.PostServiceClient postClient) : PageModel
}
Post = SnPost.FromProtoValue(response);
+
+ // Convert markdown content to HTML
+ if (Post != null && !string.IsNullOrEmpty(Post.Content))
+ Post.Content = Markdown.ToHtml(Post.Content);
return Page();
}
+
+
+ Posted on @Model.Post.CreatedAt.ToDateTimeOffset().ToString("yyyy-MM-dd HH:mm")
+
-
- @if (Model.Post.Attachments.Any())
+
+ @if (Model.Post.EditedAt.HasValue)
{
-
- @foreach (var attachment in Model.Post.Attachments)
- {
-
+
- @if (Model.Post.Categories.Any() || (Model.Post.Tags != null && Model.Post.Tags.Any()))
- {
-
- @if (attachment.MimeType!.StartsWith("image"))
- {
-
-
-
- }
- else if (attachment.MimeType!.StartsWith("video"))
- {
-
- }
- else if (attachment.MimeType!.StartsWith("audio"))
- {
-
- }
- else
- {
- @attachment.Name
- }
-
- }
+
+
+
+ Updated on @Model.Post.EditedAt.Value.ToDateTimeOffset().ToString("yyyy-MM-dd HH:mm")
+
}
+
- @foreach (var category in Model.Post.Categories)
+
- }
- else
- {
-
+
-
+
+
+ @if (!string.IsNullOrWhiteSpace(Model.Post.Description))
{
-
-
- @(!string.IsNullOrEmpty(category.Name) ? category.Name : category.Slug)
-
+
+
+ @if (Model.Post.Attachments.Any())
+ {
+ @Model.Post.Description
} - @if (Model.Post.Tags != null) - { + @Html.Raw(Model.Post.Content) +
+ @foreach (var attachment in Model.Post.Attachments)
+ {
+
+ }
+
+ @if (Model.Post.Categories.Any() || (Model.Post.Tags.Any()))
+ {
+
+ @if (attachment.MimeType!.StartsWith("image"))
+ {
+
+
+
+ }
+ else if (attachment.MimeType!.StartsWith("video"))
+ {
+
+ }
+ else if (attachment.MimeType!.StartsWith("audio"))
+ {
+
+ }
+ else
+ {
+ @attachment.Name
+ }
+
+ }
+
+ @foreach (var category in Model.Post.Categories)
+ {
+
+
+ @(!string.IsNullOrEmpty(category.Name) ? category.Name : category.Slug)
+
+ }
@foreach (var tag in Model.Post.Tags)
{
-
+
@(!string.IsNullOrEmpty(tag.Name) ? tag.Name : tag.Slug)
-
+
}
- }
-
- }
-
-
-
+ }
- Posted on @Model.Post.CreatedAt.ToDateTimeOffset().ToString("yyyy-MM-dd")
-
+
-
- }
+ }
+ else
+ {
+ Post not found.
-
+
+ }
+
Post not found.
+