标签修改
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<% if (theme.blogrolls && theme.blogrolls.length > 0) { %>
|
||||
<%
|
||||
var extraClass = '';
|
||||
if (idx.current % 3 === 0) {
|
||||
extraClass += ' first';
|
||||
if (idx.current >= 3) {
|
||||
extraClass += ' newline';
|
||||
}
|
||||
}
|
||||
%>
|
||||
<div class="widget blogroll<%= extraClass %>">
|
||||
<h3 class="title"><%= __('blogroll') %></h3>
|
||||
<ul class="entry">
|
||||
<% theme.blogrolls.forEach(function(item){ %>
|
||||
<%
|
||||
var description, linkURL
|
||||
for (var tmp in item) {
|
||||
description = tmp;
|
||||
linkURL = item[tmp];
|
||||
}
|
||||
%>
|
||||
<li><a href="<%- linkURL %>" target="_blank"><%= description %></a></li>
|
||||
<% }); %>
|
||||
</ul>
|
||||
</div>
|
||||
<% } else {
|
||||
idx.current -= 1
|
||||
} %>
|
||||
@@ -0,0 +1,65 @@
|
||||
<% if (site.categories.length){ %>
|
||||
<%
|
||||
var extraClass = '';
|
||||
if (idx.current % 3 === 0) {
|
||||
extraClass += ' first';
|
||||
if (idx.current >= 3) {
|
||||
extraClass += ' newline';
|
||||
}
|
||||
}
|
||||
%>
|
||||
<div class="widget tag<%= extraClass %>">
|
||||
<h3 class="title"><%= __('categories') %></h3>
|
||||
<div class="entry">
|
||||
<%
|
||||
var catTree = {};
|
||||
site.categories.each(function(item) {
|
||||
if(item.posts.length > 0) {
|
||||
var cats = item.path.split('/');
|
||||
var i, depth = 0;
|
||||
var addTree = function(root, i) {
|
||||
if(i + 1 > cats.length) {
|
||||
return;
|
||||
} else if(!root.hasOwnProperty(cats[i])) {
|
||||
root[cats[i]] = {posts_num: item.posts.length};
|
||||
addTree(root[cats[i]], i + 1);
|
||||
} else {
|
||||
//root[cats[i]]['posts_num'] += 1;
|
||||
addTree(root[cats[i]], i + 1);
|
||||
}
|
||||
};
|
||||
addTree(catTree, 1);
|
||||
}
|
||||
});
|
||||
%>
|
||||
|
||||
<%
|
||||
var walk = function(root, path, depth) {
|
||||
var item;
|
||||
%>
|
||||
<ul>
|
||||
|
||||
<%
|
||||
for(item in root) {
|
||||
if(item.length > 0 && item != 'posts_num'){
|
||||
var space = '';
|
||||
for(i = 0; i < depth; i++) {
|
||||
space += '--';
|
||||
}
|
||||
%>
|
||||
<li><a href="<%- config.root %><%- path + item + '/' %>"><%= item %></a><small><%= root[item]['posts_num'] %></small></li>
|
||||
<%
|
||||
walk(root[item], path + item + '/', depth + 1);
|
||||
}
|
||||
}
|
||||
%>
|
||||
</ul>
|
||||
<%
|
||||
};
|
||||
walk(catTree, 'categories/', 0);
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
<% } else {
|
||||
idx.current -= 1
|
||||
} %>
|
||||
@@ -0,0 +1,23 @@
|
||||
<% if (site.posts.length){ %>
|
||||
<%
|
||||
var extraClass = '';
|
||||
if (idx.current % 3 === 0) {
|
||||
extraClass += ' first';
|
||||
if (idx.current >= 3) {
|
||||
extraClass += ' newline';
|
||||
}
|
||||
}
|
||||
%>
|
||||
<div class="widget recent-posts<%= extraClass %>">
|
||||
<h3 class="title"><%= __('recent_posts') %></h3>
|
||||
<ul class="entry">
|
||||
<% site.posts.sort('date', -1).limit(5).each(function(post){ %>
|
||||
<li>
|
||||
<a href="<%= config.root %><%= post.path %>"><%= post.title %></a>
|
||||
</li>
|
||||
<% }); %>
|
||||
</ul>
|
||||
</div>
|
||||
<% } else {
|
||||
idx.current -= 1
|
||||
} %>
|
||||
@@ -0,0 +1,21 @@
|
||||
<% if (site.tags.length){ %>
|
||||
<%
|
||||
var extraClass = '';
|
||||
if (idx.current % 3 === 0) {
|
||||
extraClass += ' first';
|
||||
if (idx.current >= 3) {
|
||||
extraClass += ' newline';
|
||||
}
|
||||
}
|
||||
%>
|
||||
<div class="widget tag<%= extraClass %>">
|
||||
<h3 class="title"><%= __('tags') %></h3>
|
||||
<ul class="entry">
|
||||
<% site.tags.sort('name').each(function(item){ %>
|
||||
<li><a href="<%- url_for(item.path) %>"><%= item.name %></a><small><%= item.posts.length %></small></li>
|
||||
<% }); %>
|
||||
</ul>
|
||||
</div>
|
||||
<% } else {
|
||||
idx.current -= 1
|
||||
} %>
|
||||
@@ -0,0 +1,19 @@
|
||||
<% if (site.tags.length){ %>
|
||||
<%
|
||||
var extraClass = '';
|
||||
if (idx.current % 3 === 0) {
|
||||
extraClass += ' first';
|
||||
if (idx.current >= 3) {
|
||||
extraClass += ' newline';
|
||||
}
|
||||
}
|
||||
%>
|
||||
<div class="widget tagcloud<%= extraClass %>">
|
||||
<h3 class="title"><%= __('tagcloud') %></h3>
|
||||
<div class="entry">
|
||||
<%- tagcloud(site.tags, {}) %>
|
||||
</div>
|
||||
</div>
|
||||
<% } else {
|
||||
idx.current -= 1
|
||||
} %>
|
||||
Reference in New Issue
Block a user