Skip to content

Commit

Permalink
fixed some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
cofess committed Nov 6, 2017
1 parent ebdc909 commit 475c0cf
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 5 deletions.
1 change: 0 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ config:
menu_highlight: false # 是否开启当前菜单高亮显示
thumbnail: false # enable posts thumbnail, options: true, false
excerpt_link: Read More
fancybox: false

# Pagination
pagination:
Expand Down
1 change: 0 additions & 1 deletion _config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ config:
menu_highlight: false # 是否开启当前菜单高亮显示
thumbnail: false # enable posts thumbnail, options: true, false
excerpt_link: Read More
fancybox: false

# Pagination
pagination:
Expand Down
8 changes: 8 additions & 0 deletions layout/_partial/post/thumbnail.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<a href="<%- url_for((post.link ? post.link : post.path)) %>" class="thumb">
<% var thumbnailUrl = thumbnail(post) %>
<% if (thumbnailUrl) { %>
<span style="background-image:url(<%= thumbnailUrl %>)" alt="<%= post.title %>" class="thumb-image"></span>
<% } else { %>
<span class="thumb-image thumb-none"></span>
<% } %>
</a>
4 changes: 2 additions & 2 deletions layout/_widget/recent_posts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<% site.posts.sort('date', -1).limit(5).each(function(post){ %>
<li>
<% if(theme.config.thumbnail == true) { %>
<div class="item-thumbnail">
<%- partial('common/thumbnail.ejs', {post: post}) %>
<div class="item-thumb">
<%- partial('_partial/post/thumbnail.ejs', {post: post}) %>
</div>
<% } %>
<div class="item-inner">
Expand Down
9 changes: 9 additions & 0 deletions scripts/thumbnail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Thumbnail Helper
* @description Get the thumbnail url from a post
* @example
* <%- thumbnail(post) %>
*/
hexo.extend.helper.register('thumbnail', function (post) {
return post.thumbnail || post.banner || '';
});
2 changes: 1 addition & 1 deletion source/css/style.css

Large diffs are not rendered by default.

Binary file modified source/images/avatar.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/thumb-default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 475c0cf

Please sign in to comment.