[opt] more default layout

This commit is contained in:
xaoxuu 2022-11-29 22:25:02 +08:00
parent e9f9d0e560
commit 060c73d431
7 changed files with 38 additions and 11 deletions

View File

@ -25,10 +25,22 @@ sidebar:
# about: '[关于](/about/)'
# Sidebar 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'
# 文档内页
wiki: search, ghrepo, toc, ghissues, related # for pages using 'layout:wiki'
# 其它 layout:page 的页面
page: welcome, toc, search # for custom pages using 'layout:page'
######## Index ########
post-index: # 近期发布 分类 标签 归档 and ...

View File

@ -6,6 +6,17 @@ search:
layout: search
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:
layout: ghrepo
related:

View File

@ -14,8 +14,14 @@ if (page.sidebar == undefined) {
} else {
page.sidebar = theme.sidebar.widgets.wiki;
}
} else if (is_home() || ['categories', 'tags', 'archives', 'index', '404', undefined].includes(page.layout)) {
page.sidebar = theme.sidebar.widgets.index;
} else if (is_home()) {
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') {
page.sidebar = theme.sidebar.widgets.page;
} else {

View File

@ -1,6 +1,6 @@
<%
if (page.menu_id == undefined) {
if (page.layout === 'index' && page.wiki) {
if (page.layout === 'wiki_index' && page.wiki) {
page.menu_id = 'wiki';
} else {
page.menu_id = 'post';

View File

@ -3,7 +3,7 @@ if (page.menu_id == undefined) {
page.menu_id = 'wiki';
}
if (page.layout == undefined) {
page.layout = 'index';
page.layout = 'wiki_index';
}
if (page.title == undefined) {
if (page.tagName) {
@ -21,7 +21,7 @@ function layoutTitle() {
}
}
%>
<% if (page.layout === 'index') { %>
<% if (page.layout === 'wiki_index') { %>
<%- partial('index') %>
<% } else { %>
<%

View File

@ -44,10 +44,8 @@
.search-result-title
color: $color-hover
.search-result-title
background-image: none
color: var(--text-p1)
text-transform: capitalize
font-weight: bold
font-weight: 700
line-height: 1.2
.search-result-content

View File

@ -60,7 +60,7 @@ var searchFunc = function(path, filter, searchId, contentId) {
if (filter && !data.path.includes(filter)) {
return;
}
var dataTitle = data.title.trim().toLowerCase();
var dataTitle = data.title.trim();
var dataTitleLowerCase = dataTitle.toLowerCase();
var dataContent = data.content;
var dataContentLowerCase = dataContent.toLowerCase();