diff --git a/src/Moonglade.Configuration/ContentSettings.cs b/src/Moonglade.Configuration/ContentSettings.cs index ebc5c4228..0e42d8f14 100644 --- a/src/Moonglade.Configuration/ContentSettings.cs +++ b/src/Moonglade.Configuration/ContentSettings.cs @@ -7,6 +7,9 @@ public class ContentSettings : IBlogSettings { [Display(Name = "Comment provider")] public CommentProvider CommentProvider { get; set; } + + [Display(Name = "Comments display order")] + public CommentOrder CommentOrder { get; set; } [Display(Name = "Post title alignment")] public PostTitleAlignment PostTitleAlignment { get; set; } = PostTitleAlignment.Left; @@ -91,6 +94,12 @@ public enum CommentProvider ThirdParty = 1 } +public enum CommentOrder +{ + OldToNew = 0, + NewToOld = 1 +} + public enum PostTitleAlignment { Left = 0, diff --git a/src/Moonglade.Web/Pages/Components/CommentList/Default.cshtml b/src/Moonglade.Web/Pages/Components/CommentList/Default.cshtml index 545c63b82..7924061f9 100644 --- a/src/Moonglade.Web/Pages/Components/CommentList/Default.cshtml +++ b/src/Moonglade.Web/Pages/Components/CommentList/Default.cshtml @@ -20,8 +20,13 @@ @if (null != Model && Model.Any()) { + var orderedList = + BlogConfig.ContentSettings.CommentOrder == CommentOrder.NewToOld ? + Model.OrderByDescending(m => m.CreateTimeUtc) : + Model.OrderBy(m => m.CreateTimeUtc); +
@Html.Raw(ContentProcessor.MarkdownToContent(reply.ReplyContent, ContentProcessor.MarkdownConvertType.Html)) diff --git a/src/Moonglade.Web/Pages/Settings/Content.cshtml b/src/Moonglade.Web/Pages/Settings/Content.cshtml index 7e90d4ba4..104a7d9e3 100644 --- a/src/Moonglade.Web/Pages/Settings/Content.cshtml +++ b/src/Moonglade.Web/Pages/Settings/Content.cshtml @@ -55,24 +55,43 @@