From dcc1de590c685c323d4a40f1ecadd223a8da43ec Mon Sep 17 00:00:00 2001 From: yscoder <634206017@qq.com> Date: Mon, 24 Oct 2016 21:38:49 +0800 Subject: [PATCH] card theme --- _config.yml | 6 + layout/_partial/archive.ejs | 23 +-- layout/_partial/header.ejs | 37 +++-- layout/_partial/index-item.ejs | 18 ++- layout/_partial/menu.ejs | 66 ++++---- layout/_partial/paginator.ejs | 10 ++ layout/_partial/post.ejs | 98 +++++++----- layout/_partial/post/nav.ejs | 6 +- layout/_partial/post/tag.ejs | 6 +- layout/_partial/tags-bar.ejs | 16 ++ layout/archive.ejs | 67 ++++---- layout/categories.ejs | 29 ++++ layout/category.ejs | 5 +- layout/index.ejs | 41 ++--- layout/layout.ejs | 13 +- layout/page.ejs | 2 +- layout/post.ejs | 8 +- layout/tag.ejs | 5 +- layout/tags.ejs | 38 ++++- package.json | 2 +- source/css/_partial/archives.less | 80 ++++++---- source/css/_partial/article.less | 241 ++++++++++++++++++++++------- source/css/_partial/header.less | 33 +++- source/css/_partial/highlight.less | 5 +- source/css/_partial/layout.less | 22 ++- source/css/_partial/postlist.less | 81 ++++++---- source/css/_partial/reward.less | 1 + source/css/_partial/share.less | 66 ++++++-- source/css/_partial/tags.less | 137 +++++++++++----- source/css/_partial/variable.less | 44 +++++- source/css/style.less | 3 +- source/js/main.js | 90 +++++++---- source/js/search.js | 1 + 33 files changed, 892 insertions(+), 408 deletions(-) create mode 100644 layout/_partial/paginator.ejs create mode 100644 layout/_partial/tags-bar.ejs create mode 100644 layout/categories.ejs diff --git a/_config.yml b/_config.yml index b3cceb27..2f34aae7 100644 --- a/_config.yml +++ b/_config.yml @@ -15,6 +15,9 @@ menu: url: /archives tags: url: /tags + th-list: + text: Categories + url: /categories github: url: https://github.com/yscoder target: _blank @@ -67,6 +70,9 @@ hideMenu: true toc: list_number: true # 是否显示数字排序 +#文章页版权声明内容,hexo中所有变量及辅助函数等均可调用,具体请查阅 hexo.io +copyright: 这里写留言或版权声明:<%- url %> + #站长统计,如要开启,输入CNZZ站点id,如 cnzz: 1255152447 cnzz: false diff --git a/layout/_partial/archive.ejs b/layout/_partial/archive.ejs index 821e53d8..2934784a 100644 --- a/layout/_partial/archive.ejs +++ b/layout/_partial/archive.ejs @@ -1,11 +1,14 @@ -
-
- <%- partial('post/date', { post: post, date_format: 'MMM D'}) %> -
-
+
+
+ <%- partial('post/title', { - hasLink: true - }) %> - <%- partial('post/tag') %> -
-
\ No newline at end of file + hasLink: true + }) %> +
+ <%- partial('post/tag') %> +
+ + \ No newline at end of file diff --git a/layout/_partial/header.ejs b/layout/_partial/header.ejs index 06196537..e6d4cea4 100644 --- a/layout/_partial/header.ejs +++ b/layout/_partial/header.ejs @@ -3,13 +3,13 @@ -
<%=page.title || config.title %>
+
<%=title %>
<% if(theme.search){ %>
- + @@ -22,15 +22,26 @@ <% } %>
-
-
-

<%=page.title || config.title %>

-
- <% if(page.date && !page.noDate){ %> - <%- partial('post/head-meta') %> - <% } else { %> - <%=config.subtitle %> - <% }%> -
-
+
+ +
+

<%=title %>

+ + <% if(is_home()) { %> +
+ + <% if(subTitle){ %> + <%=config.subtitle %> + <% } else { %> + <%- partial('post/head-meta') %> + <% }%> +
+ <% } %> + +
+ + <%- partial('tags-bar', { + type: hdClass.split('-')[0] + }) %> +
diff --git a/layout/_partial/index-item.ejs b/layout/_partial/index-item.ejs index 99d0accb..570e1a37 100644 --- a/layout/_partial/index-item.ejs +++ b/layout/_partial/index-item.ejs @@ -1,24 +1,28 @@
- <%- partial('post/title', { hasLink: true }) %> + class="article-card article-type-<%= post.layout %>" itemprop="blogPost"> + + <%- partial('post/title', { hasLink: true }) %> +
<% if(theme.excerpt_render) { %> <%- post.excerpt || post.content %> - <% } else { - var tagReg = /<(S*?)[^>]*>.*?|<.*? \/>/gm; - %> - <%- post.excerpt ? post.excerpt.replace(tagReg, ' ') : post.content.replace(tagReg, ' ').substring(0, theme.excerpt_length) %> + <% } else { %> + <%- post.excerpt ? strip_html(post.excerpt) : truncate(strip_html(post.content), { + length: theme.excerpt_length + }) %> <% } %> <%-theme.excerpt_link%>
- <%- partial('post/tag') %> +
diff --git a/layout/_partial/menu.ejs b/layout/_partial/menu.ejs index 98333b9c..ea124701 100644 --- a/layout/_partial/menu.ejs +++ b/layout/_partial/menu.ejs @@ -1,35 +1,37 @@ -
- - - -
-
- -
-
<%- config.author %>
- <%- mail_to(theme.email, theme.email, {class: 'mail'}) %> -
+
+ \ No newline at end of file diff --git a/layout/_partial/paginator.ejs b/layout/_partial/paginator.ejs new file mode 100644 index 00000000..ae7c3456 --- /dev/null +++ b/layout/_partial/paginator.ejs @@ -0,0 +1,10 @@ +<% if (page.total > 1){ %> + +<% } %> \ No newline at end of file diff --git a/layout/_partial/post.ejs b/layout/_partial/post.ejs index 8fa279a9..8a8e1b1f 100644 --- a/layout/_partial/post.ejs +++ b/layout/_partial/post.ejs @@ -1,49 +1,65 @@
- -
- +
+

<%- post.title %>

+ +
+ <%- post.content %> +
+ +
+
+ <%- _.template(theme.copyright)(locals) %> +
+ +
-
+ <% if(theme.reward){ %> +
+ +
+ <% } %> -
- <%- post.content %> + -
-
\ No newline at end of file +
+ + <%- partial('post/nav') %> + + <%- partial('post/comment') %> + + + diff --git a/layout/_partial/post/nav.ejs b/layout/_partial/post/nav.ejs index 4aa095b1..b7f4e27d 100644 --- a/layout/_partial/post/nav.ejs +++ b/layout/_partial/post/nav.ejs @@ -1,9 +1,9 @@ <% if (post.prev || post.next){ %> -