[opt] more default layout
This commit is contained in:
parent
e9f9d0e560
commit
060c73d431
16
_config.yml
16
_config.yml
|
@ -25,10 +25,22 @@ sidebar:
|
||||||
# about: '[关于](/about/)'
|
# about: '[关于](/about/)'
|
||||||
# Sidebar widgets
|
# Sidebar widgets
|
||||||
widgets:
|
widgets:
|
||||||
index: welcome, recent, search, timeline # for home/wiki/categories/tags/archives/404 pages
|
#### 自动生成的页面 ####
|
||||||
page: welcome, toc # for pages using 'layout:page'
|
# 主页
|
||||||
|
home: search, welcome, recent, timeline # for home
|
||||||
|
# 博客索引页
|
||||||
|
blog_index: search_blog, recent, timeline # for categories/tags/archives
|
||||||
|
# 文档索引页
|
||||||
|
wiki_index: search_docs, recent, timeline # for wiki
|
||||||
|
# 其它(404)
|
||||||
|
others: search, welcome, recent, timeline # for 404 and ...
|
||||||
|
#### 手动创建的页面 ####
|
||||||
|
# 文章内页
|
||||||
post: toc, ghrepo, search, ghissues # for pages using 'layout:post'
|
post: toc, ghrepo, search, ghissues # for pages using 'layout:post'
|
||||||
|
# 文档内页
|
||||||
wiki: search, ghrepo, toc, ghissues, related # for pages using 'layout:wiki'
|
wiki: search, ghrepo, toc, ghissues, related # for pages using 'layout:wiki'
|
||||||
|
# 其它 layout:page 的页面
|
||||||
|
page: welcome, toc, search # for custom pages using 'layout:page'
|
||||||
|
|
||||||
######## Index ########
|
######## Index ########
|
||||||
post-index: # 近期发布 分类 标签 归档 and ...
|
post-index: # 近期发布 分类 标签 归档 and ...
|
||||||
|
|
|
@ -5,6 +5,17 @@
|
||||||
search:
|
search:
|
||||||
layout: search
|
layout: search
|
||||||
filter: auto # auto or 'path'
|
filter: auto # auto or 'path'
|
||||||
|
|
||||||
|
|
||||||
|
search_blog:
|
||||||
|
layout: search
|
||||||
|
filter: /blog/ # auto or 'path'
|
||||||
|
placeholder: 文章搜索
|
||||||
|
|
||||||
|
search_docs:
|
||||||
|
layout: search
|
||||||
|
filter: /wiki/ # auto or 'path'
|
||||||
|
placeholder: 文档搜索
|
||||||
|
|
||||||
ghrepo:
|
ghrepo:
|
||||||
layout: ghrepo
|
layout: ghrepo
|
||||||
|
|
|
@ -14,8 +14,14 @@ if (page.sidebar == undefined) {
|
||||||
} else {
|
} else {
|
||||||
page.sidebar = theme.sidebar.widgets.wiki;
|
page.sidebar = theme.sidebar.widgets.wiki;
|
||||||
}
|
}
|
||||||
} else if (is_home() || ['categories', 'tags', 'archives', 'index', '404', undefined].includes(page.layout)) {
|
} else if (is_home()) {
|
||||||
page.sidebar = theme.sidebar.widgets.index;
|
page.sidebar = theme.sidebar.widgets.home;
|
||||||
|
} else if (is_category() || is_tag() || is_archive() || ['categories', 'tags', 'archives'].includes(page.layout)) {
|
||||||
|
page.sidebar = theme.sidebar.widgets.blog_index;
|
||||||
|
} else if (['wiki_index'].includes(page.layout)) {
|
||||||
|
page.sidebar = theme.sidebar.widgets.wiki_index;
|
||||||
|
} else if (['404', undefined].includes(page.layout)) {
|
||||||
|
page.sidebar = theme.sidebar.widgets.others;
|
||||||
} else if (page.layout == 'page') {
|
} else if (page.layout == 'page') {
|
||||||
page.sidebar = theme.sidebar.widgets.page;
|
page.sidebar = theme.sidebar.widgets.page;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<%
|
<%
|
||||||
if (page.menu_id == undefined) {
|
if (page.menu_id == undefined) {
|
||||||
if (page.layout === 'index' && page.wiki) {
|
if (page.layout === 'wiki_index' && page.wiki) {
|
||||||
page.menu_id = 'wiki';
|
page.menu_id = 'wiki';
|
||||||
} else {
|
} else {
|
||||||
page.menu_id = 'post';
|
page.menu_id = 'post';
|
||||||
|
|
|
@ -3,7 +3,7 @@ if (page.menu_id == undefined) {
|
||||||
page.menu_id = 'wiki';
|
page.menu_id = 'wiki';
|
||||||
}
|
}
|
||||||
if (page.layout == undefined) {
|
if (page.layout == undefined) {
|
||||||
page.layout = 'index';
|
page.layout = 'wiki_index';
|
||||||
}
|
}
|
||||||
if (page.title == undefined) {
|
if (page.title == undefined) {
|
||||||
if (page.tagName) {
|
if (page.tagName) {
|
||||||
|
@ -21,7 +21,7 @@ function layoutTitle() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<% if (page.layout === 'index') { %>
|
<% if (page.layout === 'wiki_index') { %>
|
||||||
<%- partial('index') %>
|
<%- partial('index') %>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<%
|
<%
|
||||||
|
|
|
@ -44,10 +44,8 @@
|
||||||
.search-result-title
|
.search-result-title
|
||||||
color: $color-hover
|
color: $color-hover
|
||||||
.search-result-title
|
.search-result-title
|
||||||
background-image: none
|
|
||||||
color: var(--text-p1)
|
color: var(--text-p1)
|
||||||
text-transform: capitalize
|
font-weight: 700
|
||||||
font-weight: bold
|
|
||||||
line-height: 1.2
|
line-height: 1.2
|
||||||
|
|
||||||
.search-result-content
|
.search-result-content
|
||||||
|
|
|
@ -60,7 +60,7 @@ var searchFunc = function(path, filter, searchId, contentId) {
|
||||||
if (filter && !data.path.includes(filter)) {
|
if (filter && !data.path.includes(filter)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var dataTitle = data.title.trim().toLowerCase();
|
var dataTitle = data.title.trim();
|
||||||
var dataTitleLowerCase = dataTitle.toLowerCase();
|
var dataTitleLowerCase = dataTitle.toLowerCase();
|
||||||
var dataContent = data.content;
|
var dataContent = data.content;
|
||||||
var dataContentLowerCase = dataContent.toLowerCase();
|
var dataContentLowerCase = dataContent.toLowerCase();
|
||||||
|
|
Loading…
Reference in New Issue