diff --git a/_config.yml b/_config.yml index 4d6a4d1..83587e8 100755 --- a/_config.yml +++ b/_config.yml @@ -52,6 +52,10 @@ music: links: true # layout: links 的页面是否显示 post: true # layout: post 的页面是否显示 +top_post: + icon: fas fa-award + text: 置顶 + # 推荐文章 recommended_posts: autoDisplay: false # 自动在文章底部显示推荐文章,如果你使用Material-X主题,这里要设置为false。 diff --git a/layout/_partial/archive.ejs b/layout/_partial/archive.ejs index fcef633..93c3bf3 100755 --- a/layout/_partial/archive.ejs +++ b/layout/_partial/archive.ejs @@ -14,9 +14,18 @@
<% page.posts.each(function(post){ %> + <% if (post.top == true) { %> +
+ <%- partial('post', {post: post}) %> +
+ <% } %> + <% }) %> + <% page.posts.each(function(post){ %> + <% if (!post.top || post.top != true) { %>
<%- partial('post', {post: post}) %>
+ <% } %> <% }) %>
diff --git a/layout/_partial/meta.ejs b/layout/_partial/meta.ejs index 74e2e82..fb5495e 100644 --- a/layout/_partial/meta.ejs +++ b/layout/_partial/meta.ejs @@ -53,5 +53,11 @@ <% } %> <% } %> + <% if(theme.top_post && isPostList && post.top == true){ %> +
+  <%- theme.top_post.text %> +
+ <% } %> +