Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gitcode_dev
Hexo Theme Yet The Books
提交
61da99a1
H
Hexo Theme Yet The Books
项目概览
gitcode_dev
/
Hexo Theme Yet The Books
通知
0
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hexo Theme Yet The Books
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
61da99a1
编写于
9月 06, 2021
作者:
N
Nexmoe
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新首页排版、分类模板
上级
0e6961b4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
131 addition
and
122 deletion
+131
-122
_config.yml
_config.yml
+1
-1
layout/_partial/footer.ejs
layout/_partial/footer.ejs
+14
-11
layout/archive.ejs
layout/archive.ejs
+0
-80
layout/categories.ejs
layout/categories.ejs
+38
-0
layout/index.ejs
layout/index.ejs
+68
-28
source/css/style.css
source/css/style.css
+10
-2
未找到文件。
_config.yml
浏览文件 @
61da99a1
...
...
@@ -11,7 +11,7 @@ archives:
categories
:
[
算法
,
游戏
]
# Only the categories you set will be displayed on the archive page.
menu
:
Archives
:
archiv
es
Categories
:
categori
es
About
:
about.html
footer_link
:
...
...
layout/_partial/footer.ejs
浏览文件 @
61da99a1
<div class="footer">
<div class="container">
<div class="footer-content">
<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">© <%= date(new Date(), 'YYYY') %> <%= config.title %>
Using <a rel="noreferrer" href="http://hexo.io/" target="_blank">Hexo</a>
& <a rel="noreferrer" href="https://github.com/Yet-The-Books/hexo-theme-yet-the-books" target="_blank">Yet The Books</a>
</div>
<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>
</div>
</div>
</div>
<div class="footer-copyright">
<div class="container">
© <%= date(new Date(), 'YYYY') %> <%= config.title %>
Using <a rel="noreferrer" href="http://hexo.io/" target="_blank">Hexo</a>
& <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
layout/archive.ejs
已删除
100644 → 0
浏览文件 @
0e6961b4
<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
layout/categories.ejs
0 → 100644
浏览文件 @
61da99a1
<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>
layout/index.ejs
浏览文件 @
61da99a1
...
...
@@ -11,33 +11,73 @@
</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>
<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>
</div>
\ No newline at end of file
source/css/style.css
浏览文件 @
61da99a1
...
...
@@ -385,8 +385,8 @@ a:hover {
}
.footer
{
margin-top
:
2em
;
background-color
:
#f7f3ed
;
border-top
:
2px
solid
#eee
;
}
.footer
a
{
...
...
@@ -401,7 +401,6 @@ a:hover {
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
space-between
;
flex-wrap
:
wrap
;
}
...
...
@@ -419,6 +418,15 @@ 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录