Skip to content

Commit

Permalink
模板重构, 归档样式更新, 增加category支持, release 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yscoder committed Jun 26, 2016
1 parent 886f015 commit b58192b
Show file tree
Hide file tree
Showing 33 changed files with 299 additions and 202 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ Material Design 风格的Hexo主题,基于 Hexo 3.0+ 制作。预览 [我的

## 使用

[Document](https://github.com/yscoder/hexo-theme-indigo/wiki)
[文档|Document](https://github.com/yscoder/hexo-theme-indigo/wiki)

## 更新日志

升级前请仔细查看更改内容,如非必要可不升级。

[Log](https://github.com/yscoder/hexo-theme-indigo/wiki/%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97)


## 截图
Expand All @@ -31,6 +37,13 @@ Material Design 风格的Hexo主题,基于 Hexo 3.0+ 制作。预览 [我的

### Phone

![indigo-phone-1](https://github.com/yscoder/hexo-theme-indigo/raw/master/screenshots/hexo-theme-phone-1.png)
![indigo-phone-2](https://github.com/yscoder/hexo-theme-indigo/raw/master/screenshots/hexo-theme-phone-2.png)
![indigo-phone](https://github.com/yscoder/hexo-theme-indigo/raw/master/screenshots/hexo-theme-phone.png)

### Search

![indigo-search](https://github.com/yscoder/hexo-theme-indigo/raw/master/screenshots/hexo-theme-search.png)

### Archive

![indigo-archive](https://github.com/yscoder/hexo-theme-indigo/raw/master/screenshots/hexo-theme-archive.png)

11 changes: 0 additions & 11 deletions layout/_partial/archive-post.ejs

This file was deleted.

59 changes: 11 additions & 48 deletions layout/_partial/archive.ejs
Original file line number Diff line number Diff line change
@@ -1,48 +1,11 @@
<% if (pagination == 2){ %>
<ul class="post-list">
<% page.posts.each(function(post){ %>
<li class="post-list-item"><%- partial('article', {post: post, index: true}) %></li>
<% }) %>
</ul>
<% if (page.total > 1){ %>
<nav id="page-nav">
<div class="inner">
<%- paginator({
prev_text: '上一页',
next_text: '下一页'
}) %>
</div>
</nav>
<% } %>
<% } else { %>
<% var last; %>
<% page.posts.each(function(post, i){ %>
<% var year = post.date.year(); %>
<% if (last != year){ %>
<% if (last != null){ %>
</div></section>
<% } %>
<% last = year; %>
<section class="archives-wrap flex-row">
<div class="archive-year-wrap">
<a href="<%- url_for('archives/' + year) %>" class="archive-year waves-effect waves-circle waves-light"><%= year %></a>
</div>
<div class="archives flex-col">
<% } %>
<%- partial('archive-post', {post: post, even: i % 2 == 0}) %>
<% }) %>
<% if (page.posts.length){ %>
</div>
</section>
<% } %>
<% if (page.total > 1){ %>
<nav id="page-nav">
<div class="inner">
<%- paginator({
prev_text: '上一页',
next_text: '下一页'
}) %>
</div>
</nav>
<% } %>
<% } %>
<article class="archive-article">
<div class="archive-article-date">
<%- partial('post/date', { post: post, date_format: 'MMM D'}) %>
</div>
<div class="archive-article-inner">
<%- partial('post/title', {
hasLink: true
}) %>
<%- partial('post/tag') %>
</div>
</article>
56 changes: 6 additions & 50 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<% if(post.type == 'tags') { %>
<%- partial('post/tags') %>
<% } else { %>
<article id="<%= post.layout %>-<%= post.slug %>" class="article article-type-<%= post.layout %>" itemprop="blogPost">
<article id="<%= post.layout %>-<%= post.slug %>"
class="article article-type-<%= post.layout %>" itemprop="blogPost">
<% if(index) { %>
<%- partial('post/title') %>
<%- partial('post/title', { hasLink: true }) %>
<div class="post-meat flex-row">
<div class="flex-col"><%- partial('post/tag') %></div>
<%- partial('post/date', {date_format: config.date_format}) %>
Expand All @@ -19,51 +17,9 @@
<a href="<%- url_for(post.path) %>" class="post-more waves-effect waves-button waves-light">MORE</a>
</div>
<% } else { %>
<div class="post-meat flex-row">
<div class="flex-col"><%- partial('post/tag') %></div>
</div>
<div class="post-body">
<aside class="post-widget" id="post-widget">
<% if(theme.share){ %>
<%- partial('post/share', {
className: 'post-share'
}) %>
<% } %>
<% if(theme.toc){ %>
<nav class="post-toc-wrap" id="post-toc">
<%- toc(post.content, {
class: 'post-toc',
list_number: theme.toc.list_number
}) %>
</nav>
<% } %>
</aside>
<div class="post-main">
<div class="post-content" id="post-content" itemprop="postContent">
<%- post.content %>
<blockquote>
<p>
本文地址:
<a href="<%- page.permalink%>" target="_blank" rel="external"><%- page.permalink %></a>
</p>
<footer><cite><a href="<%- config.url %>">@<%- config.title %></a></cite></footer>
</blockquote>
</div>
<%- partial('post/nav') %>
<%- partial('post/comment') %>
</div>
</div>
<%- partial('post') %>
<% } %>

</article>
<% } %>
</article>
8 changes: 7 additions & 1 deletion layout/_partial/header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
<header class="content-header">
<div class="container">
<h1 class="author"><%=page.title || config.title %></h1>
<h5 class="subtitle"><%=(page.date && !page.noDate ? date(page.date, config.date_format) : config.subtitle) %></h5>
<h5 class="subtitle">
<% if(page.date && !page.noDate){ %>
<%- partial('post/head-meta') %>
<% } else { %>
<%=config.subtitle %>
<% }%>
</h5>
</div>
</header>
17 changes: 17 additions & 0 deletions layout/_partial/index-item.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<article id="<%= post.layout %>-<%= post.slug %>"
class="article article-type-<%= post.layout %>" itemprop="blogPost">
<%- partial('post/title', { hasLink: true }) %>
<div class="post-meta">
<%- partial('post/date', {date_format: config.date_format}) %>
<%- partial('post/category') %>
</div>

<div class="post-content" id="post-content" itemprop="postContent" >
<% if (post.excerpt){ %>
<%- post.excerpt %>
<% } else { %>
<%- post.content %>
<% } %>
</div>
<%- partial('post/tag') %>
</article>
42 changes: 42 additions & 0 deletions layout/_partial/post.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<article id="<%= post.layout %>-<%= post.slug %>"
class="article article-type-<%= post.layout %>" itemprop="blogPost">
<div class="post-meat flex-row">
<%- partial('post/tag') %>
</div>
<div class="post-body">
<aside class="post-widget" id="post-widget">

<% if(theme.share){ %>
<%- partial('post/share', {
className: 'post-share'
}) %>
<% } %>

<% if(theme.toc){ %>
<nav class="post-toc-wrap" id="post-toc">
<%- toc(post.content, {
class: 'post-toc',
list_number: theme.toc.list_number
}) %>
</nav>
<% } %>
</aside>

<div class="post-main">

<div class="post-content" id="post-content" itemprop="postContent">
<%- post.content %>
<blockquote>
<p>
本文地址:
<a href="<%- page.permalink%>" target="_blank" rel="external"><%- page.permalink %></a>
</p>
<footer><cite><a href="<%- config.url %>">@<%- config.title %></a></cite></footer>
</blockquote>
</div>
<%- partial('post/nav') %>

<%- partial('post/comment') %>
</div>
</div>
</article>
6 changes: 2 additions & 4 deletions layout/_partial/post/category.ejs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<% if (post.categories && post.categories.length){ %>
<div class="article-category tagcloud">
<%- list_categories(post.categories, {
show_count: false,
class: 'article-category',
style: 'none',
separator: ''
style: 'list'
}) %>
</div>
<% } %>

4 changes: 2 additions & 2 deletions layout/_partial/post/comment.ejs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<% if (!index && theme.duoshuo && post.comments){ %>
<% if (theme.duoshuo && post.comments){ %>
<%- partial('duoshuo', {
key: post.slug,
title: post.title,
url: url
}) %>
<% } %>

<% if (!index && post.comments && config.disqus_shortname){ %>
<% if (post.comments && config.disqus_shortname){ %>
<section id="comments">
<div id="disqus_thread"></div>
<script type="text/javascript">
Expand Down
6 changes: 3 additions & 3 deletions layout/_partial/post/date.ejs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<time datetime="<%= date_xml(post.date) %>" itemprop="datePublished" class="post-tiem">
<%= date(post.date, date_format) %>
</time>
<time datetime="<%= date_xml(post.date) %>" itemprop="datePublished" class="post-time">
<%= post.date.format(date_format) %>
</time>
11 changes: 11 additions & 0 deletions layout/_partial/post/head-meta.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<time datetime="<%= date_xml(page.date) %>" itemprop="datePublished" class="page-time">
<%= page.date.format(config.date_format) %>
</time>

<% if (page.categories && page.categories.length){ %>
<%- list_categories(page.categories, {
show_count: false,
class: 'article-category',
style: 'list'
}) %>
<% } %>
2 changes: 1 addition & 1 deletion layout/_partial/post/title.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<a class="post-title-link" href="<%- url_for(post.link) %>" target="_blank" itemprop="url"><%- post.title %></a>
</h3>
<% } else if (post.title){ %>
<% if (index){ %>
<% if (hasLink){ %>
<h3 class="post-title" itemprop="name">
<a class="post-title-link" href="<%- url_for(post.path) %>"><%= post.title %></a>
</h3>
Expand Down
38 changes: 37 additions & 1 deletion layout/archive.ejs
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
<%- partial('_partial/archive', {pagination: config.archive, index: true}) %>
<%
var posts = [];
page.posts.each(function(post){
posts.push(post);
});
var sortPosts = _.orderBy(posts, ['date'], ['desc']);
%>

<%
var y = 0, m = 0;
sortPosts.forEach(function(post, i){
var dt = post.date;
var ny = post.date.year();
var nm = post.date.month();
if(ny !== y || nm !== m) {
y = ny;
m = nm;
%>
<h3 class="archive-separator"><%=dt.format('MMMM, YYYY')%></h3>
<% } %>
<%- partial('_partial/archive', {post: post}) %>
<%})%>

<% if (page.total > 1){ %>
<nav id="page-nav">
<div class="inner">
<%- paginator({
prev_text: '上一页',
next_text: '下一页'
}) %>
</div>
</nav>
<% } %>
2 changes: 1 addition & 1 deletion layout/category.ejs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%- partial('_partial/archive', {pagination: config.archive, index: true}) %>
<%- partial('archive', {pagination: config.archive}) %>
21 changes: 20 additions & 1 deletion layout/index.ejs
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
<%- partial('_partial/archive', {pagination: 2, index: true}) %>
<ul class="post-list">
<% page.posts.each(function(post){ %>
<li class="post-list-item">
<%- partial('_partial/index-item', {
post: post,
index: true
}) %>
</li>
<% }) %>
</ul>
<% if (page.total > 1){ %>
<nav id="page-nav">
<div class="inner">
<%- paginator({
prev_text: '上一页',
next_text: '下一页'
}) %>
</div>
</nav>
<% } %>
2 changes: 1 addition & 1 deletion layout/page.ejs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%- partial('_partial/article', {post: page, index: false}) %>
<%- partial('_partial/post', {post: page }) %>
2 changes: 1 addition & 1 deletion layout/post.ejs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%- partial('_partial/article', {post: page, index: false}) %>
<%- partial('_partial/post', {post: page }) %>
2 changes: 1 addition & 1 deletion layout/tag.ejs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%- partial('_partial/archive', {pagination: config.archive, index: true}) %>
<%- partial('archive', {pagination: config.archive}) %>
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "hexo-theme-material-indigo",
"version": "0.3.1",
"version": "0.4.1",
"private": true
}
Binary file added screenshots/hexo-theme-archive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/hexo-theme-pad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/hexo-theme-pc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshots/hexo-theme-phone-1.png
Binary file not shown.
Binary file removed screenshots/hexo-theme-phone-2.png
Binary file not shown.
Binary file added screenshots/hexo-theme-phone.png
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 screenshots/hexo-theme-search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b58192b

Please sign in to comment.