Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gitcode_dev
Hexo Theme Yet The Books
提交
ad16968c
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,发现更多精彩内容 >>
提交
ad16968c
编写于
8月 17, 2021
作者:
折
折影轻梦
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
归档页,设置默认显示的分类,其他隐藏
上级
7d9dd799
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
78 addition
and
8 deletion
+78
-8
_config.yml
_config.yml
+4
-0
layout/archive.ejs
layout/archive.ejs
+42
-6
layout/post.ejs
layout/post.ejs
+1
-1
source/css/style.css
source/css/style.css
+12
-0
source/js/core.js
source/js/core.js
+19
-1
未找到文件。
_config.yml
浏览文件 @
ad16968c
...
...
@@ -5,6 +5,10 @@ search: https://cn.bing.com/search?q= # https://www.google.com/search?q==
order_by
:
date
# date,-date,title,url,...
head
:
'
<!--<script
src=""
async></script>-->'
# 在 <head></head> 中添加自定义的内容
archives
:
switch
:
false
# true,false 来开关本功能
categories
:
[
算法
,
游戏
]
# 仅你设置的分类会在归档页面显示
menu
:
归档
:
archives
关于
:
about.html
...
...
layout/archive.ejs
浏览文件 @
ad16968c
...
...
@@ -5,21 +5,53 @@
</div>
</div>
<div class="container">
<article class="post">
<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 => { %>
<li><a href="<%- url_for(post.path) %>" >
<span class="title"><%- post.title %></span>
<span class="date"><span><%= date(post.date, 'MM-DD') %></span></span>
</a></li>
<% 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"><%- 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"><%- post.title %></span>
<span class="date"><span><%= date(post.date, 'MM-DD') %></span></span>
</a></li>
<% } %>
<% }) %>
<% }) %>
</ul>
<% } %>
...
...
@@ -41,4 +73,8 @@
%>
</article>
</div>
</div>
\ No newline at end of file
</div>
<script>
</script>
\ No newline at end of file
layout/post.ejs
浏览文件 @
ad16968c
...
...
@@ -22,7 +22,7 @@
<article class="post">
<%- page.content %>
<br>
<%- list_tags(page.tags,{
<%- list_tags(page.tags,
{
show_count: true,
style: "unordered list",
separator: ", "
...
...
source/css/style.css
浏览文件 @
ad16968c
...
...
@@ -347,6 +347,18 @@ a:hover {
position
:
relative
;
}
.content
.catalogue
.hidden
{
display
:
none
;
}
.content
.catalogue
.display
{
display
:
block
;
}
.content
.archive
.display-btn
{
cursor
:
pointer
;
}
.content
.tag-unordered
{
word-break
:
break-word
;
}
...
...
source/js/core.js
浏览文件 @
ad16968c
function
search
()
{
window
.
open
(
document
.
getElementById
(
"
search_form
"
).
getAttribute
(
"
action_e
"
)
+
"
"
+
document
.
getElementById
(
"
search_value
"
).
value
document
.
getElementById
(
"
search_form
"
).
getAttribute
(
"
action_e
"
)
+
"
"
+
document
.
getElementById
(
"
search_value
"
).
value
);
return
false
;
}
let
display
=
false
;
function
displayAll
()
{
let
elements
=
document
.
querySelectorAll
(
"
.catalogue .hidden
"
);
if
(
!
display
)
{
for
(
let
elem
of
elements
)
{
elem
.
style
.
display
=
"
block
"
;
display
=
true
;
}
}
else
{
for
(
let
elem
of
elements
)
{
elem
.
style
.
display
=
"
none
"
;
display
=
false
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录