From de38d1d7c34cf1fdc399fbe4cabe7516f80a391c Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Sun, 30 Dec 2018 22:48:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=96=87=E7=AB=A0=E7=BD=AE?= =?UTF-8?q?=E9=A1=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 4 ++++ layout/_partial/archive.ejs | 9 +++++++++ layout/_partial/meta.ejs | 6 ++++++ 3 files changed, 19 insertions(+) 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 %> +
+ <% } %> +