From 46727537aa73c5fbf1a2540480600afe2652f7c6 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Wed, 19 Dec 2018 21:46:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/_partial/article.ejs | 87 +------------------ layout/_partial/comments.ejs | 47 ++++++++++ layout/_partial/meta.ejs | 60 +++++++++++++ layout/_partial/post.ejs | 25 +----- .../_partial/{post => }/recommended_posts.ejs | 0 layout/index.ejs | 2 +- layout/links.ejs | 62 ++++++------- 7 files changed, 145 insertions(+), 138 deletions(-) create mode 100644 layout/_partial/comments.ejs create mode 100644 layout/_partial/meta.ejs rename layout/_partial/{post => }/recommended_posts.ejs (100%) diff --git a/layout/_partial/article.ejs b/layout/_partial/article.ejs index 8e0201f..e8d76ee 100755 --- a/layout/_partial/article.ejs +++ b/layout/_partial/article.ejs @@ -1,40 +1,5 @@ -
-
- <% if(post.music){ %> -
-
- <% } %> -
- <% if(post.title){ %> -

<%= post.title %>

- <% } else if (post.date) { %> -

<%= date(post.date, config.date_format) %>

- <% } %> - - - <% if (config.leancloud && config.leancloud.app_id && config.leancloud.app_key) { %> -
- - - -
- <% } else { %> -
- -
- <% } %> - - <%- partial('categories',{post:post}) %> -
-
- +
+ <%- partial('meta',{post:post}) %>
@@ -127,53 +92,7 @@
- -<% if (post && ((theme.recommended_posts && theme.recommended_posts.autoDisplay == false && post.recommended_posts != false) || (post.comments && (config.disqus_shortname || config.livere_shortname || config.valine)) )) { %> -
-
- - <% if (theme.recommended_posts && theme.recommended_posts.autoDisplay == false && post.recommended_posts != false) { %> - <%- partial('post/recommended_posts', {page: post, site: site}) %> - <% } %> - - <% if (post.comments) { %> - -

 评论

- <% if (config.disqus_shortname) { %> -
-
- ⚠️ 无法加载评论系统,请确保您的网络能够正常访问 Disqus 。 -
-
- <% } %> - - <% if (config.livere_uid){ %> -
-
- -
-
- <% } %> - - <% if (config.valine){ %> - <% if (config.valine.enable && config.valine.app_id && config.valine.app_key){ %> -
-
文明评论,请勿灌水。为了便于区分和接收回复提醒,请您在留言时填写一下昵称邮箱
-
-
-
- -
-
- - - <% } %> - <% } %> - <% } %> - -
-
-<% } %> +<%- partial('comments') %> + + <% } %> + <% } %> + <% } %> + +
+
+<% } %> diff --git a/layout/_partial/meta.ejs b/layout/_partial/meta.ejs new file mode 100644 index 0000000..4b3d5b2 --- /dev/null +++ b/layout/_partial/meta.ejs @@ -0,0 +1,60 @@ +<% if(is_home() || is_category() || is_archive() || is_tag()) { + var isPostList = true; +} else { + var isPostList = false; +} %> +
+ <% if((!isPostList && post.music) || (isPostList && post.music && post.music.enable == true)){ %> +
+
+ <% } %> +
+ <% if(isPostList){ %> +

+ + <% if(post.title){ %> + <%= post.title %> + <% } else if (post.date) { %> + <%= date(post.date, config.date_format) %> + <% } %> + +

+ <% } else { %> + <% if(post.title){ %> +

<%= post.title %>

+ <% } else if (post.date) { %> +

<%= date(post.date, config.date_format) %>

+ <% } %> + <% } %> + + <% if(post.date){ %> + + <% } %> + + <% if(post.categories){ %> + <%- partial('categories',{post:post}) %> + <% } %> + + <% if(!isPostList){ %> + <% if (post.visitors_count != false && config.leancloud && config.leancloud.app_id && config.leancloud.app_key) { %> +
+ + + +
+ <% } else { %> +
+ +
+ <% } %> + <% } %> + +
+
diff --git a/layout/_partial/post.ejs b/layout/_partial/post.ejs index 44cafcb..af31143 100755 --- a/layout/_partial/post.ejs +++ b/layout/_partial/post.ejs @@ -1,28 +1,5 @@
"> -
- <% if(post.music && !post.music.internal){ %> -
-
- <% } %> -

- - <% if(post.title){ %> - <%= post.title %> - <% } else if (post.date) { %> - <%= date(post.date, config.date_format) %> - <% } %> - -

- - <%- partial('categories',{post:post}) %> -
- + <%- partial('meta',{post:post}) %>
<%- post.excerpt || post.description || post.content %> <% if (post.readmore != false && (post.excerpt || post.description)) { %> diff --git a/layout/_partial/post/recommended_posts.ejs b/layout/_partial/recommended_posts.ejs similarity index 100% rename from layout/_partial/post/recommended_posts.ejs rename to layout/_partial/recommended_posts.ejs diff --git a/layout/index.ejs b/layout/index.ejs index c0cdb27..c2c550c 100755 --- a/layout/index.ejs +++ b/layout/index.ejs @@ -1 +1 @@ -<%- partial('_partial/archive') %> \ No newline at end of file +<%- partial('_partial/archive') %> diff --git a/layout/links.ejs b/layout/links.ejs index b09fd8c..15a9870 100755 --- a/layout/links.ejs +++ b/layout/links.ejs @@ -1,31 +1,35 @@ -<% if (page.links){ %> - <% (page.links||[]).forEach(function(group){ %> - <% if(group.items) { %> -
- <% if(group.type) { %> - <% if (group.icon) { %> -

<%= group.type %>

- <%} else {%> -

<%= group.type %>

- <%} %> - <%} %> - <% (group.items||[]).forEach(function(item){ %> -
-
- -
-
-

<%= item.name %>

-

<%= item.desc %>

-
- <% (item.tags||[]).forEach(function(tag){ %> - <%= tag %> +
+ <%- partial('_partial/meta',{post:page}) %> +
+ <% if (page.links){ %> + <% (page.links||[]).forEach(function(group){ %> + <% if(group.items) { %> +
+ <% if(group.type) { %> + <% if (group.icon) { %> +

<%= group.type %>

+ <%} else {%> +

<%= group.type %>

+ <%} %> + <%} %> + <% (group.items||[]).forEach(function(item){ %> +
+
+ +
+
+

<%= item.name %>

+

<%= item.desc %>

+
+ <% (item.tags||[]).forEach(function(tag){ %> + <%= tag %> + <% }) %> +
+
<% }) %> -
-
+
+ <%} %> <% }) %> -
- <%} %> - <% }) %> -<% } %> -<%- partial('_partial/article', {post: page, index: false}) %> + <% } %> + +