提交 b61d32db 编写于 作者: N Nexmoe

Revert "新首页排版、分类模板"

This reverts commit 61da99a1.
上级 61da99a1
......@@ -11,7 +11,7 @@ archives:
categories: [算法,游戏] # Only the categories you set will be displayed on the archive page.
menu:
Categories: categories
Archives: archives
About: about.html
footer_link:
......
<div class="footer">
<div class="container">
<div class="footer-content">
<div class="footer-widget"><%= config.title %></div>
<div class="footer-widget">
<% for (name in theme.footer_link) { %>
<a href="<%- url_for(theme.footer_link[name]) %>"><%= name %></a>
<% } %>
<div class="footer-left"><%= config.title %></div>
<div class="footer-right">
<div class="footer-links">
<% for (name in theme.footer_link) { %>
<a href="<%- url_for(theme.footer_link[name]) %>"><%= name %></a>
<% } %>
</div>
<div calss="footer-copyright">&copy; <%= date(new Date(), 'YYYY') %> <%= config.title %>
Using <a rel="noreferrer" href="http://hexo.io/" target="_blank">Hexo</a>
&amp; <a rel="noreferrer" href="https://github.com/Yet-The-Books/hexo-theme-yet-the-books" target="_blank">Yet The Books</a>
</div>
</div>
</div>
</div>
</div>
<div class="footer-copyright">
<div class="container">
&copy; <%= date(new Date(), 'YYYY') %> <%= config.title %>
Using <a rel="noreferrer" href="http://hexo.io/" target="_blank">Hexo</a>
&amp; <a rel="noreferrer" href="https://github.com/Yet-The-Books/hexo-theme-yet-the-books" target="_blank">Yet The Books</a>
</div>
</div>
\ No newline at end of file
<div class="content">
<div class="banner">
<div class="container">
<h1>归档</h1>
</div>
</div>
<div class="container">
<article class="post archive">
<%- list_tags({
show_count: true,
style: "unordered list",
separator: ", "
}) %>
<% if(theme.archives.switch) { %>
<p>当前默认显示的分类为:
<% for (index in theme.archives.categories) { %>
<%- theme.archives.categories[index] %>
<% } %>
(<a class="display-btn" onclick="displayAll()">显示所有</a>)
</p>
<% } %>
<% // 参考:https://github.com/SukkaW/hexo-theme-suka/blob/master/layout/_pages/archive.ejs %>
<% function buildArchive(posts, year) { %>
<h2><%= year %></h2>
<ul class="catalogue">
<% posts.sort('date',-1).each(post => { %>
<% post.categories.map(function(category){ %>
<%
// 判断是否为已设置需要显示的分类
let displayTF = false;
if(theme.archives.switch) {
for (index in theme.archives.categories) {
if(category.name == theme.archives.categories[index]){
displayTF = true;
}
}
} else {
displayTF = true;
}
%>
<% if(displayTF){ %>
<li class="display"><a href="<%- url_for(post.path) %>" >
<span class="title"><%- category.name %>:<%- post.title %></span>
<span class="date"><span><%= date(post.date, 'MM-DD') %></span></span>
</a></li>
<% } else { %>
<li class="hidden"><a href="<%- url_for(post.path) %>" >
<span class="title"><%- category.name %>:<%- post.title %></span>
<span class="date"><span><%= date(post.date, 'MM-DD') %></span></span>
</a></li>
<% } %>
<% }) %>
<% }) %>
</ul>
<% } %>
<%
if (!page.year) {
let years = {};
let allpost = page.tag ? site.tags.findOne({name: page.tag}).posts : site.posts;
allpost.each(post => years[post.date.year()] = null);
for (let year of Object.keys(years).sort((a, b) => b - a)) {
let posts = allpost.filter(p => p.date.year() == year);
buildArchive(posts, year)
}
} else {
let year = page.year;
let posts = site.posts.filter(p => p.date.year() == year);
buildArchive(posts, year)
}
%>
</article>
</div>
</div>
<script>
</script>
\ No newline at end of file
<div class="content">
<div class="banner">
<div class="container">
<h1><%= page.title %> </h1>
</div>
</div>
<div class="container">
<div class="category">
<% site.categories.sort('length').map(function(category){ %>
<% let cover = ""
let color = "red"
category.posts.sort('-date').map(function(post){
if(post.cover!==undefined && cover==""){
cover = post.cover
}
if(post.color!==undefined && color=="red"){
color = post.color
}
})
%>
<% if(cover == ""){ %>
<a class="category-item" href="<%- url_for(category.path) %>">
<div class="cover <%= color %>"><h1><%= category.name %></h1></div>
<div class="title"><%= category.name %></div>
</a>
<% } else { %>
<a class="category-item" href="<%- url_for(category.path) %>">
<div class="cover"><img data-sizes="auto"
data-src="<%= cover %>" class="lazyload" alt="<%= category.name %>"></div>
<div class="title"><%= category.name %></div>
</a>
<% } %>
<% }) %>
</div>
</div>
</div>
......@@ -11,73 +11,33 @@
</div>
</div>
<div class="container">
<article class="archive">
<%- list_tags({
show_count: true,
style: "unordered list",
separator: ", "
}) %>
<% if(theme.archives.switch) { %>
<p>当前默认显示的分类为:
<% for (index in theme.archives.categories) { %>
<%- theme.archives.categories[index] %>
<% } %>
(<a class="display-btn" onclick="displayAll()">显示所有</a>)
</p>
<% } %>
<% // 参考:https://github.com/SukkaW/hexo-theme-suka/blob/master/layout/_pages/archive.ejs %>
<% function buildArchive(posts, year) { %>
<h2><%= year %></h2>
<ul class="catalogue">
<% posts.sort('date',-1).each(post => { %>
<% post.categories.map(function(category){ %>
<%
// 判断是否为已设置需要显示的分类
let displayTF = false;
if(theme.archives.switch) {
for (index in theme.archives.categories) {
if(category.name == theme.archives.categories[index]){
displayTF = true;
}
}
} else {
displayTF = true;
}
%>
<% if(displayTF){ %>
<li class="display"><a href="<%- url_for(post.path) %>" >
<span class="title"><%- category.name %>:<%- post.title %></span>
<span class="date"><span><%= date(post.date, 'MM-DD') %></span></span>
</a></li>
<% } else { %>
<li class="hidden"><a href="<%- url_for(post.path) %>" >
<span class="title"><%- category.name %>:<%- post.title %></span>
<span class="date"><span><%= date(post.date, 'MM-DD') %></span></span>
</a></li>
<% } %>
<% }) %>
<% }) %>
</ul>
<% } %>
<%
if (!page.year) {
let years = {};
let allpost = page.tag ? site.tags.findOne({name: page.tag}).posts : site.posts;
allpost.each(post => years[post.date.year()] = null);
for (let year of Object.keys(years).sort((a, b) => b - a)) {
let posts = allpost.filter(p => p.date.year() == year);
buildArchive(posts, year)
}
} else {
let year = page.year;
let posts = site.posts.filter(p => p.date.year() == year);
buildArchive(posts, year)
}
%>
</article>
<div class="category">
<% site.categories.sort('length').map(function(category){ %>
<% let cover = ""
let color = "red"
category.posts.sort('-date').map(function(post){
if(post.cover!==undefined && cover==""){
cover = post.cover
}
if(post.color!==undefined && color=="red"){
color = post.color
}
})
%>
<% if(cover == ""){ %>
<a class="category-item" href="<%- url_for(category.path) %>">
<div class="cover <%= color %>"><h1><%= category.name %></h1></div>
<div class="title"><%= category.name %></div>
</a>
<% } else { %>
<a class="category-item" href="<%- url_for(category.path) %>">
<div class="cover"><img data-sizes="auto"
data-src="<%= cover %>" class="lazyload" alt="<%= category.name %>"></div>
<div class="title"><%= category.name %></div>
</a>
<% } %>
<% }) %>
</div>
</div>
</div>
\ No newline at end of file
......@@ -385,8 +385,8 @@ a:hover {
}
.footer {
margin-top: 2em;
background-color: #f7f3ed;
border-top: 2px solid #eee;
}
.footer a {
......@@ -401,6 +401,7 @@ a:hover {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
}
......@@ -418,15 +419,6 @@ a:hover {
margin-left: .5em;
}
.footer-copyright {
text-align: center;
padding: 1.5em;
}
.footer-copyright a {
color: #aa874b;
}
article p {
line-height: 1.5em;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册