[opt] code optimization
This commit is contained in:
parent
8e8b63169b
commit
5bc949fc22
|
@ -11,6 +11,7 @@ stellar:
|
||||||
preconnect:
|
preconnect:
|
||||||
# - https://gcore.jsdelivr.net
|
# - https://gcore.jsdelivr.net
|
||||||
# - https://unpkg.com
|
# - https://unpkg.com
|
||||||
|
# - https://cdn.bootcdn.net
|
||||||
|
|
||||||
open_graph:
|
open_graph:
|
||||||
enable: true
|
enable: true
|
||||||
|
@ -369,9 +370,9 @@ plugins:
|
||||||
# https://scrollrevealjs.org/api/reveal.html
|
# https://scrollrevealjs.org/api/reveal.html
|
||||||
scrollreveal:
|
scrollreveal:
|
||||||
enable: #true
|
enable: #true
|
||||||
js: https://gcore.jsdelivr.net/npm/scrollreveal@4.0.9/dist/scrollreveal.min.js
|
js: https://cdn.bootcdn.net/ajax/libs/scrollReveal.js/4.0.9/scrollreveal.min.js
|
||||||
distance: 8px
|
distance: 16px
|
||||||
duration: 500 # ms
|
duration: 800 # ms
|
||||||
interval: 100 # ms
|
interval: 100 # ms
|
||||||
scale: 1 # 0.1~1
|
scale: 1 # 0.1~1
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<%
|
<%
|
||||||
function layoutCover() {
|
function layoutCover() {
|
||||||
if (page.layout == 'wiki') {
|
if (page.wiki) {
|
||||||
return partial('wiki_cover');
|
return partial('wiki_cover')
|
||||||
}
|
}
|
||||||
if (page.layout == 'post') {
|
if (page.layout === 'post') {
|
||||||
return partial('post_cover');
|
return partial('post_cover')
|
||||||
}
|
}
|
||||||
return '';
|
return ''
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<%- layoutCover() %>
|
<%- layoutCover() %>
|
||||||
|
|
|
@ -26,7 +26,7 @@ function div() {
|
||||||
url = 'https://source.unsplash.com/random/2000x400';
|
url = 'https://source.unsplash.com/random/2000x400';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
el += '<div class="l_cover post' + scrollreveal() + '">';
|
el += '<div class="l_cover post' + scrollreveal(' ') + '">';
|
||||||
el += '<div class="cover">';
|
el += '<div class="cover">';
|
||||||
if (theme.plugins.lazyload && theme.plugins.lazyload.enable) {
|
if (theme.plugins.lazyload && theme.plugins.lazyload.enable) {
|
||||||
el += '<div class="lazy img bg" data-bg="' + url + '"></div>';
|
el += '<div class="lazy img bg" data-bg="' + url + '"></div>';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<%
|
<%
|
||||||
function layoutWikiCover() {
|
function layoutWikiCover() {
|
||||||
var el = '';
|
var el = '';
|
||||||
let proj = theme.wiki.tree[page.wiki];
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
if (proj == undefined) {
|
if (proj == undefined) {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ function layoutWikiCover() {
|
||||||
if (coverpage === true) {
|
if (coverpage === true) {
|
||||||
coverpage = ['cover', 'title', 'description'];
|
coverpage = ['cover', 'title', 'description'];
|
||||||
}
|
}
|
||||||
el += '<div class="l_cover wiki' + scrollreveal() + '">';
|
el += '<div class="l_cover wiki' + scrollreveal(' ') + '">';
|
||||||
el += '<article class="cover-wrap md-text">';
|
el += '<article class="cover-wrap md-text">';
|
||||||
|
|
||||||
if (cover?.length > 0 && coverpage.includes('cover')) {
|
if (cover?.length > 0 && coverpage.includes('cover')) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<%
|
<%
|
||||||
function generate_title() {
|
function generate_title() {
|
||||||
if (page.wiki) {
|
if (page.wiki) {
|
||||||
let proj = theme.wiki.tree[page.wiki];
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
let wiki = (proj && proj.name) || page.wiki;
|
const wiki = proj?.name || page.wiki
|
||||||
if (page.title) {
|
if (page.title) {
|
||||||
return wiki + __('symbol.colon') + page.title + ' - ' + config.title;
|
return wiki + __('symbol.colon') + page.title + ' - ' + config.title;
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,9 +24,9 @@ function generate_description() {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (page.wiki) {
|
if (page.wiki) {
|
||||||
let proj = theme.wiki.tree[page.wiki];
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
if (proj && proj.description) {
|
if (proj?.description) {
|
||||||
return '<meta name="description" content="' + proj.description + '">';
|
return '<meta name="description" content="' + proj.description + '">'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (page.description || page.excerpt || page.content) {
|
if (page.description || page.excerpt || page.content) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ function layoutDiv() {
|
||||||
if (item.length === 0) {
|
if (item.length === 0) {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
el += '<div class="article-footer reveal fs14">';
|
el += `<div class="article-footer${scrollreveal(' ')} fs14">`
|
||||||
if (page.references?.length > 0) {
|
if (page.references?.length > 0) {
|
||||||
function refList() {
|
function refList() {
|
||||||
var el = '';
|
var el = '';
|
||||||
|
@ -39,7 +39,7 @@ function layoutDiv() {
|
||||||
|
|
||||||
var license = ''
|
var license = ''
|
||||||
if (page.wiki) {
|
if (page.wiki) {
|
||||||
let proj = theme.wiki.tree[page.wiki]
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
if (page.license != null) {
|
if (page.license != null) {
|
||||||
license = page.license || theme.article.license
|
license = page.license || theme.article.license
|
||||||
} else if (proj?.license != null) {
|
} else if (proj?.license != null) {
|
||||||
|
@ -76,7 +76,7 @@ function layoutDiv() {
|
||||||
|
|
||||||
var showSharePlugin = false
|
var showSharePlugin = false
|
||||||
if (page.wiki) {
|
if (page.wiki) {
|
||||||
let proj = theme.wiki.tree[page.wiki]
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
if (page.share != null) {
|
if (page.share != null) {
|
||||||
showSharePlugin = page.share == true
|
showSharePlugin = page.share == true
|
||||||
} else if (proj != null) {
|
} else if (proj != null) {
|
||||||
|
@ -101,7 +101,7 @@ function layoutDiv() {
|
||||||
el += '&title=' + page.title + ' - ' + config.title;
|
el += '&title=' + page.title + ' - ' + config.title;
|
||||||
if (page.layout == 'post' && page.cover) {
|
if (page.layout == 'post' && page.cover) {
|
||||||
el += '&pics=' + page.cover;
|
el += '&pics=' + page.cover;
|
||||||
} else if (page.layout == 'wiki' && page.icon) {
|
} else if (page.wiki && page.icon) {
|
||||||
el += '&pics=' + page.icon;
|
el += '&pics=' + page.icon;
|
||||||
}
|
}
|
||||||
el += '&summary=' + truncate(page.description || strip_html(page.excerpt || page.content), {length: 120});
|
el += '&summary=' + truncate(page.description || strip_html(page.excerpt || page.content), {length: 120});
|
||||||
|
|
|
@ -7,10 +7,10 @@ function layoutDiv() {
|
||||||
if (page.layout === 'post') {
|
if (page.layout === 'post') {
|
||||||
prev = page.prev
|
prev = page.prev
|
||||||
next = page.next
|
next = page.next
|
||||||
} else if (page.layout === 'wiki' && page.wiki?.length > 0) {
|
} else if (page.wiki?.length > 0) {
|
||||||
var title_prev = __('meta.prev');
|
var title_prev = __('meta.prev');
|
||||||
var title_next = __('meta.next');
|
var title_next = __('meta.next');
|
||||||
let proj = theme.wiki.tree[page.wiki];
|
const proj = theme.wiki.tree[page.wiki];
|
||||||
if (proj) {
|
if (proj) {
|
||||||
let ps = proj.pages?.filter(p => p.path == page.path)
|
let ps = proj.pages?.filter(p => p.path == page.path)
|
||||||
if (ps?.length > 0) {
|
if (ps?.length > 0) {
|
||||||
|
@ -33,7 +33,7 @@ function layoutDiv() {
|
||||||
}
|
}
|
||||||
let el = '';
|
let el = '';
|
||||||
if (prev || next) {
|
if (prev || next) {
|
||||||
el += '<div class="related-wrap reveal" id="read-next">';
|
el += `<div class="related-wrap${scrollreveal(' ')}" id="read-next">`
|
||||||
el += '<section class="body">';
|
el += '<section class="body">';
|
||||||
// prev
|
// prev
|
||||||
el += '<div class="item" id="prev">';
|
el += '<div class="item" id="prev">';
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
function layoutDiv() {
|
function layoutDiv() {
|
||||||
if (theme.article.related_posts.enable) {
|
if (theme.article.related_posts.enable) {
|
||||||
var el = '';
|
var el = '';
|
||||||
el += '<div class="related-wrap reveal" id="related-posts">';
|
el += `<div class="related-wrap${scrollreveal(' ')}" id="related-posts">`
|
||||||
el += popular_posts_wrapper({
|
el += popular_posts_wrapper({
|
||||||
title: __('meta.related_posts'),
|
title: __('meta.related_posts'),
|
||||||
json: popular_posts_json({ maxCount: theme.article.related_posts.max_count , ulClass: 'related-posts' , PPMixingRate: 0.2 , isImage: true , isExcerpt: true} , page )
|
json: popular_posts_json({ maxCount: theme.article.related_posts.max_count , ulClass: 'related-posts' , PPMixingRate: 0.2 , isImage: true , isExcerpt: true} , page )
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
const content = theme.footer.content?.replace('${author.name}', (config.author || 'Anonymity'))?.replace('${theme.name}', stellar_info('name'))?.replace('${theme.version}', stellar_info('version'))?.replace('${theme.tree}', stellar_info('tree'))
|
const content = theme.footer.content?.replace('${author.name}', (config.author || 'Anonymity'))?.replace('${theme.name}', stellar_info('name'))?.replace('${theme.version}', stellar_info('version'))?.replace('${theme.tree}', stellar_info('tree'))
|
||||||
function layoutDiv() {
|
function layoutDiv() {
|
||||||
var el = ''
|
var el = ''
|
||||||
el += '<footer class="page-footer reveal fs12">'
|
el += `<footer class="page-footer${scrollreveal(' ')} fs12">`
|
||||||
el += '<hr>'
|
el += '<hr>'
|
||||||
// sitemap
|
// sitemap
|
||||||
if (theme.footer.sitemap && Object.keys(theme.footer.sitemap).length > 0) {
|
if (theme.footer.sitemap && Object.keys(theme.footer.sitemap).length > 0) {
|
||||||
|
|
|
@ -99,7 +99,7 @@ function layoutDiv() {
|
||||||
nodes.push(url);
|
nodes.push(url);
|
||||||
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __("btn.wiki") + '</a>';
|
el += '<a class="cap breadcrumb" id="menu" href="' + url + '">' + __("btn.wiki") + '</a>';
|
||||||
// 项目名
|
// 项目名
|
||||||
let proj = theme.wiki.tree[page.wiki];
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
if (proj != null) {
|
if (proj != null) {
|
||||||
let url_proj = url_for(proj.homepage?.path);
|
let url_proj = url_for(proj.homepage?.path);
|
||||||
if (nodes.includes(url_proj) === false) {
|
if (nodes.includes(url_proj) === false) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<% if ((is_home() || is_category() || is_tag()) && page.total > 1) { %>
|
<% if ((is_home() || is_category() || is_tag()) && page.total > 1) { %>
|
||||||
<div class='paginator-wrap dis-select'>
|
<div class='paginator-wrap dis-select<%- scrollreveal(' ') %>'>
|
||||||
<%- paginator({
|
<%- paginator({
|
||||||
prev_text: '',
|
prev_text: '',
|
||||||
next_text: '',
|
next_text: '',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<% if (page.layout === 'post' || (page.layout === 'wiki' && page.wiki && page.wiki.length > 0)) { %>
|
<% if (page.layout === 'post' || (page.wiki?.length > 0)) { %>
|
||||||
<script>
|
<script>
|
||||||
let tianliGPT_postSelector = '.md-text.content.<%= page.layout === "post" ? "post" : "wiki" %>';
|
let tianliGPT_postSelector = '.md-text.content.<%= page.layout === "post" ? "post" : "wiki" %>';
|
||||||
let tianliGPT_key = '<%= theme.plugins.tianli_gpt.api %>';
|
let tianliGPT_key = '<%= theme.plugins.tianli_gpt.api %>';
|
||||||
|
|
|
@ -12,8 +12,8 @@ if (theme.comments.service && theme.comments.service.length > 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 合并项目评论
|
// 合并项目评论
|
||||||
let proj = theme.wiki.tree[page.wiki];
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
if (loadComment && page.layout == 'wiki' && page.wiki && (proj != null)) {
|
if (loadComment && (proj != null)) {
|
||||||
if (proj.comment_title != undefined && page.comment_title == undefined) {
|
if (proj.comment_title != undefined && page.comment_title == undefined) {
|
||||||
if (['utterances', 'beaudar', 'giscus'].includes(theme.comments.service)) {
|
if (['utterances', 'beaudar', 'giscus'].includes(theme.comments.service)) {
|
||||||
page.comment_title = proj.comment_title;
|
page.comment_title = proj.comment_title;
|
||||||
|
@ -31,7 +31,7 @@ if (cmt.service && page[cmt.service]) {
|
||||||
page.cmt = cmt;
|
page.cmt = cmt;
|
||||||
%>
|
%>
|
||||||
<% if (loadComment) { %>
|
<% if (loadComment) { %>
|
||||||
<div class='related-wrap md-text reveal' id="comments">
|
<div class="related-wrap md-text<%- scrollreveal(' ') %>" id="comments">
|
||||||
<section class='header cmt-title cap theme'>
|
<section class='header cmt-title cap theme'>
|
||||||
<%- page.comment_title != undefined ? markdown(page.comment_title) : __('meta.comment_title') %>
|
<%- page.comment_title != undefined ? markdown(page.comment_title) : __('meta.comment_title') %>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
<%
|
<%
|
||||||
|
|
||||||
|
const wiki = theme.wiki.tree[page.wiki]
|
||||||
|
const topic = theme.topic.tree[page.topic]
|
||||||
|
|
||||||
if (page.sidebar == null) {
|
if (page.sidebar == null) {
|
||||||
const { site_tree } = theme
|
const { site_tree } = theme
|
||||||
var sidebar
|
var sidebar
|
||||||
|
@ -11,7 +15,7 @@ if (page.sidebar == null) {
|
||||||
sidebar = site_tree.blog.sidebar
|
sidebar = site_tree.blog.sidebar
|
||||||
} else if (page.topic?.length > 0) {
|
} else if (page.topic?.length > 0) {
|
||||||
sidebar = site_tree.topic.sidebar
|
sidebar = site_tree.topic.sidebar
|
||||||
} else if (page.layout === 'index_wiki' || page.layout === 'wiki') {
|
} else if (page.layout === 'index_wiki' || page.wiki) {
|
||||||
sidebar = site_tree.wiki.sidebar
|
sidebar = site_tree.wiki.sidebar
|
||||||
} else if (page.layout === '404') {
|
} else if (page.layout === '404') {
|
||||||
sidebar = site_tree.error_page.sidebar
|
sidebar = site_tree.error_page.sidebar
|
||||||
|
@ -25,16 +29,17 @@ if (page.sidebar == null) {
|
||||||
sidebar = []
|
sidebar = []
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page.topic && theme.topic?.tree[page.topic]?.sidebar) {
|
if (topic?.sidebar) {
|
||||||
sidebar = theme.topic.tree[page.topic].sidebar
|
sidebar = topic.sidebar
|
||||||
}
|
}
|
||||||
if (page.layout == 'wiki' && page.wiki && theme.wiki?.tree[page.wiki]?.sidebar) {
|
if (wiki?.sidebar) {
|
||||||
sidebar = theme.wiki.tree[page.wiki].sidebar
|
sidebar = wiki.sidebar
|
||||||
}
|
}
|
||||||
|
|
||||||
page.sidebar = sidebar
|
page.sidebar = sidebar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse array string
|
// parse array string
|
||||||
if (typeof page.sidebar == 'string') {
|
if (typeof page.sidebar == 'string') {
|
||||||
page.sidebar = page.sidebar.replace(/ /g, '').split(',');
|
page.sidebar = page.sidebar.replace(/ /g, '').split(',');
|
||||||
|
@ -57,10 +62,6 @@ function layoutTitle(main, url, sub) {
|
||||||
}
|
}
|
||||||
function layoutWidgets() {
|
function layoutWidgets() {
|
||||||
var el = '';
|
var el = '';
|
||||||
var proj;
|
|
||||||
if (page.layout === 'wiki' && page.wiki) {
|
|
||||||
proj = theme.wiki.tree[page.wiki];
|
|
||||||
}
|
|
||||||
el += '<div class="widgets">';
|
el += '<div class="widgets">';
|
||||||
if (page.sidebar) {
|
if (page.sidebar) {
|
||||||
page.sidebar.forEach((w, i) => {
|
page.sidebar.forEach((w, i) => {
|
||||||
|
@ -71,8 +72,8 @@ function layoutWidgets() {
|
||||||
} else if (typeof w == 'object' && w.override) {
|
} else if (typeof w == 'object' && w.override) {
|
||||||
name = w.override
|
name = w.override
|
||||||
}
|
}
|
||||||
if (name in theme.data.widgets) {
|
if (name in theme.widgets) {
|
||||||
Object.assign(widget, theme.data.widgets[name])
|
Object.assign(widget, theme.widgets[name])
|
||||||
}
|
}
|
||||||
if (typeof w == 'object' && (w.override || w.layout)) {
|
if (typeof w == 'object' && (w.override || w.layout)) {
|
||||||
Object.assign(widget, w)
|
Object.assign(widget, w)
|
||||||
|
@ -128,17 +129,11 @@ function layoutNavArea() {
|
||||||
var search = {}
|
var search = {}
|
||||||
if (page.search) {
|
if (page.search) {
|
||||||
search = page.search
|
search = page.search
|
||||||
} else if (page.wiki && page.layout == 'wiki' && theme.wiki.tree[page.wiki]) {
|
} else if (wiki?.search) {
|
||||||
const proj = theme.wiki.tree[page.wiki]
|
search = wiki.search
|
||||||
if (proj.search) {
|
} else if (topic?.search) {
|
||||||
search = proj.search
|
|
||||||
}
|
|
||||||
} else if (page.topic && theme.topic.tree[page.topic]) {
|
|
||||||
const topic = theme.topic.tree[page.topic]
|
|
||||||
if (topic.search) {
|
|
||||||
search = topic.search
|
search = topic.search
|
||||||
}
|
}
|
||||||
}
|
|
||||||
var el = ''
|
var el = ''
|
||||||
el += `<div class="nav-area">`
|
el += `<div class="nav-area">`
|
||||||
el += partial('search', {item: search})
|
el += partial('search', {item: search})
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
var logo = theme.logo
|
var logo = theme.logo
|
||||||
if (page.logo) {
|
if (page.logo) {
|
||||||
logo = Object.assign({}, logo, page.logo)
|
logo = Object.assign({}, logo, page.logo)
|
||||||
} else if (page.wiki && page.layout == 'wiki' && theme.wiki.tree[page.wiki]) {
|
} else if (theme.wiki.tree[page.wiki]) {
|
||||||
const proj = theme.wiki.tree[page.wiki]
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
var l = proj.logo
|
var l = proj.logo
|
||||||
if (l) {
|
if (l) {
|
||||||
|
@ -14,7 +14,7 @@ if (page.logo) {
|
||||||
subtitle: proj.subtitle
|
subtitle: proj.subtitle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (page.topic && theme.topic.tree[page.topic]) {
|
} else if (theme.topic.tree[page.topic]) {
|
||||||
const topic = theme.topic.tree[page.topic]
|
const topic = theme.topic.tree[page.topic]
|
||||||
var l = topic.logo
|
var l = topic.logo
|
||||||
if (l) {
|
if (l) {
|
||||||
|
@ -48,11 +48,16 @@ function layoutTitle(main, url, sub) {
|
||||||
|
|
||||||
function layoutDiv() {
|
function layoutDiv() {
|
||||||
if (where == 'main') {
|
if (where == 'main') {
|
||||||
if (page.layout == 'wiki' && page.menu_id == 'wiki') {
|
if (page.header == false) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
if (page.header == false) {
|
// 内容页如果未设置 header 则不显示
|
||||||
return
|
if (page.header == null) {
|
||||||
|
if (!page.nav_tabs) { // 如果有 nav_tabs 就代表是列表页
|
||||||
|
if (page.layout === 'post' || page.layout === 'page' || page.wiki) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var el = ''
|
var el = ''
|
||||||
|
|
|
@ -8,7 +8,7 @@ function layoutDiv() {
|
||||||
el += `<form class="search-form">`
|
el += `<form class="search-form">`
|
||||||
var filter = ''
|
var filter = ''
|
||||||
if (item.filter == 'auto') {
|
if (item.filter == 'auto') {
|
||||||
if (page.layout == 'wiki') {
|
if (page.wiki) {
|
||||||
let matches = page.path.match(/(.*?)\/(.*?)\//i)
|
let matches = page.path.match(/(.*?)\/(.*?)\//i)
|
||||||
if (matches?.length > 0) {
|
if (matches?.length > 0) {
|
||||||
filter = matches[0]
|
filter = matches[0]
|
||||||
|
|
|
@ -5,13 +5,11 @@ function layoutDiv() {
|
||||||
var branch = 'main';
|
var branch = 'main';
|
||||||
if (page.repo) {
|
if (page.repo) {
|
||||||
repo = page.repo
|
repo = page.repo
|
||||||
} else if (page.layout === 'wiki' && page.wiki) {
|
} else if (theme.wiki.tree[page.wiki]?.repo) {
|
||||||
let proj = theme.wiki.tree[page.wiki];
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
if (proj && proj.repo) {
|
repo = proj.repo
|
||||||
repo = proj.repo;
|
|
||||||
if (proj.branch != undefined) {
|
if (proj.branch != undefined) {
|
||||||
branch = proj.branch;
|
branch = proj.branch
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (repo == undefined) {
|
if (repo == undefined) {
|
||||||
|
@ -21,7 +19,7 @@ function layoutDiv() {
|
||||||
if (item.labels) {
|
if (item.labels) {
|
||||||
item.api += '&labels=' + item.labels;
|
item.api += '&labels=' + item.labels;
|
||||||
}
|
}
|
||||||
el += '<widget class="widget-wrapper timeline">';
|
el += `<widget class="widget-wrapper${scrollreveal(' ')} timeline">`
|
||||||
if (item.title) {
|
if (item.title) {
|
||||||
el += '<div class="widget-header dis-select">';
|
el += '<div class="widget-header dis-select">';
|
||||||
el += '<span class="name">' + item.title + '</span>';
|
el += '<span class="name">' + item.title + '</span>';
|
||||||
|
|
|
@ -5,20 +5,18 @@ function layoutDiv() {
|
||||||
var branch = 'main';
|
var branch = 'main';
|
||||||
if (page.repo) {
|
if (page.repo) {
|
||||||
repo = page.repo
|
repo = page.repo
|
||||||
} else if (page.layout === 'wiki' && page.wiki) {
|
} else if (theme.wiki.tree[page.wiki]?.repo) {
|
||||||
let proj = theme.wiki.tree[page.wiki];
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
if (proj && proj.repo) {
|
repo = proj.repo
|
||||||
repo = proj.repo;
|
|
||||||
if (proj.branch != undefined) {
|
if (proj.branch != undefined) {
|
||||||
branch = proj.branch;
|
branch = proj.branch
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (repo == undefined) {
|
if (repo == undefined) {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
// 布局
|
// 布局
|
||||||
el += '<widget class="widget-wrapper ghrepo">';
|
el += `<widget class="widget-wrapper${scrollreveal(' ')} ghrepo">`
|
||||||
// body
|
// body
|
||||||
el += '<div class="widget-body">';
|
el += '<div class="widget-body">';
|
||||||
el += '<div class="items stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/repos/' + repo + '">';
|
el += '<div class="items stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/repos/' + repo + '">';
|
||||||
|
|
|
@ -22,7 +22,7 @@ function layoutDiv() {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
el += '<widget class="widget-wrapper ghuser">';
|
el += `<widget class="widget-wrapper${scrollreveal(' ')} ghuser">`
|
||||||
// body
|
// body
|
||||||
el += '<div class="widget-body stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/users/' + item.username + '">';
|
el += '<div class="widget-body stellar-ghinfo-api" api="' + theme.api_host.ghapi + '/users/' + item.username + '">';
|
||||||
if (item.avatar) {
|
if (item.avatar) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
function layoutDiv() {
|
function layoutDiv() {
|
||||||
if (!item.content?.length && !item.src?.length) return ''
|
if (!item.content?.length && !item.src?.length) return ''
|
||||||
var el = '';
|
var el = '';
|
||||||
el += '<widget class="widget-wrapper markdown">';
|
el += `<widget class="widget-wrapper${scrollreveal(' ')} markdown">`
|
||||||
if (item.title?.length > 0) {
|
if (item.title?.length > 0) {
|
||||||
el += '<div class="widget-header dis-select">';
|
el += '<div class="widget-header dis-select">';
|
||||||
el += '<span class="name">' + item.title + '</span>';
|
el += '<span class="name">' + item.title + '</span>';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<%
|
<%
|
||||||
function layoutDiv() {
|
function layoutDiv() {
|
||||||
var el = '<widget class="widget-wrapper post-list">';
|
var el = `<widget class="widget-wrapper${scrollreveal(' ')} post-list">`
|
||||||
// header
|
// header
|
||||||
el += '<div class="widget-header dis-select">';
|
el += '<div class="widget-header dis-select">';
|
||||||
el += '<span class="name">' + __("meta.recent_update") + '</span>';
|
el += '<span class="name">' + __("meta.recent_update") + '</span>';
|
||||||
|
@ -32,8 +32,8 @@ function layoutDiv() {
|
||||||
const isActive = post.path == page.path
|
const isActive = post.path == page.path
|
||||||
el += `<a class="item title${post.path == page.path ? ' active' : ''}" href="${url_for(post.link || post.path)}">`
|
el += `<a class="item title${post.path == page.path ? ' active' : ''}" href="${url_for(post.link || post.path)}">`
|
||||||
el += '<span class="title">'
|
el += '<span class="title">'
|
||||||
if (post.layout == 'wiki') {
|
if (post.wiki) {
|
||||||
let proj = theme.wiki.tree[post.wiki];
|
const proj = theme.wiki.tree[post.wiki];
|
||||||
let name = proj?.name || post?.wiki;
|
let name = proj?.name || post?.wiki;
|
||||||
if (name) {
|
if (name) {
|
||||||
el += '<strong>' + name + '</strong>' + '<span class="dot"></span>';
|
el += '<strong>' + name + '</strong>' + '<span class="dot"></span>';
|
||||||
|
|
|
@ -8,7 +8,7 @@ function relatedPostsInTopic() {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
var el = ''
|
var el = ''
|
||||||
el += `<widget class="widget-wrapper post-list">`
|
el += `<widget class="widget-wrapper${scrollreveal(' ')} post-list">`
|
||||||
el += `<div class="widget-header dis-select">`
|
el += `<div class="widget-header dis-select">`
|
||||||
el += `<span class="name">${__('btn.topic') + __('symbol.colon') + topic.name}</span>`
|
el += `<span class="name">${__('btn.topic') + __('symbol.colon') + topic.name}</span>`
|
||||||
el += `</div>`
|
el += `</div>`
|
||||||
|
@ -34,7 +34,7 @@ function relatedWiki() {
|
||||||
const relatedItems = thisItemObject.relatedItems
|
const relatedItems = thisItemObject.relatedItems
|
||||||
var el = ''
|
var el = ''
|
||||||
for (let relatedItem of relatedItems) {
|
for (let relatedItem of relatedItems) {
|
||||||
el += `<widget class="widget-wrapper post-card">`
|
el += `<widget class="widget-wrapper${scrollreveal(' ')} post-card">`
|
||||||
el += `<div class="widget-header dis-select">`
|
el += `<div class="widget-header dis-select">`
|
||||||
el += `<span class="name">${__('meta.more') + __('symbol.colon') + relatedItem.name}</span>`
|
el += `<span class="name">${__('meta.more') + __('symbol.colon') + relatedItem.name}</span>`
|
||||||
el += `</div>`
|
el += `</div>`
|
||||||
|
|
|
@ -8,7 +8,7 @@ function layoutDiv() {
|
||||||
delete opts['title'];
|
delete opts['title'];
|
||||||
delete opts['layout'];
|
delete opts['layout'];
|
||||||
opts.class = 'tag ';
|
opts.class = 'tag ';
|
||||||
el += '<widget class="widget-wrapper tagcloud">';
|
el += `<widget class="widget-wrapper${scrollreveal(' ')} tagcloud">`
|
||||||
if (item.title) {
|
if (item.title) {
|
||||||
el += '<div class="widget-header dis-select">';
|
el += '<div class="widget-header dis-select">';
|
||||||
el += '<span class="name">' + item.title + '</span>';
|
el += '<span class="name">' + item.title + '</span>';
|
||||||
|
|
|
@ -4,7 +4,7 @@ function layoutDiv() {
|
||||||
if (item.api == undefined) {
|
if (item.api == undefined) {
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
el += '<widget class="widget-wrapper timeline">';
|
el += `<widget class="widget-wrapper${scrollreveal(' ')} timeline">`
|
||||||
if (item.title) {
|
if (item.title) {
|
||||||
el += '<div class="widget-header dis-select">';
|
el += '<div class="widget-header dis-select">';
|
||||||
el += '<span class="name">' + item.title + '</span>';
|
el += '<span class="name">' + item.title + '</span>';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<%
|
<%
|
||||||
let proj = theme.wiki.tree[page.wiki];
|
const proj = theme.wiki.tree[page.wiki]
|
||||||
var hasTOC = true
|
var hasTOC = true
|
||||||
function layoutTocBody() {
|
function layoutTocBody() {
|
||||||
if (toc(page.content).length > 0) {
|
if (toc(page.content).length > 0) {
|
||||||
|
@ -56,12 +56,8 @@ function layoutDocTree(pages) {
|
||||||
|
|
||||||
function layoutDiv(fallback) {
|
function layoutDiv(fallback) {
|
||||||
var type = ''
|
var type = ''
|
||||||
if (proj && proj.pages) {
|
if (proj?.pages) {
|
||||||
if (proj.pages.length > 1) {
|
type = proj.pages.length > 1 ? 'multi' : 'single'
|
||||||
type = 'multi'
|
|
||||||
} else {
|
|
||||||
type = 'single'
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let toc_content = toc(page.content)
|
let toc_content = toc(page.content)
|
||||||
if (toc_content && toc_content.length > 0) {
|
if (toc_content && toc_content.length > 0) {
|
||||||
|
@ -71,19 +67,8 @@ function layoutDiv(fallback) {
|
||||||
|
|
||||||
var el = ''
|
var el = ''
|
||||||
if (type.length > 0) {
|
if (type.length > 0) {
|
||||||
el += `<widget class="widget-wrapper toc ${type}" id="data-toc" collapse="${item.collapse}">`
|
el += `<widget class="widget-wrapper${scrollreveal(' ')} toc ${type}" id="data-toc" collapse="${item.collapse}">`
|
||||||
if (page.layout !== 'wiki') {
|
if (proj) {
|
||||||
// post 布局
|
|
||||||
el += layoutTocHeader()
|
|
||||||
el += `<div class="widget-body fs14">`
|
|
||||||
el += `<div class="doc-tree active">`
|
|
||||||
el += layoutTocBody()
|
|
||||||
el += `</div>`
|
|
||||||
el += `</div>`
|
|
||||||
if (hasTOC == false) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
} else if (proj) {
|
|
||||||
// wiki 布局
|
// wiki 布局
|
||||||
if (proj.sections && proj.sections.length > 0 && proj.pages.length > 1) { // 多 pages
|
if (proj.sections && proj.sections.length > 0 && proj.pages.length > 1) { // 多 pages
|
||||||
for (let sec of proj.sections) {
|
for (let sec of proj.sections) {
|
||||||
|
@ -108,10 +93,21 @@ function layoutDiv(fallback) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// post 布局
|
||||||
|
el += layoutTocHeader()
|
||||||
|
el += `<div class="widget-body fs14">`
|
||||||
|
el += `<div class="doc-tree active">`
|
||||||
|
el += layoutTocBody()
|
||||||
|
el += `</div>`
|
||||||
|
el += `</div>`
|
||||||
|
if (hasTOC == false) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
el += `</widget>`
|
el += `</widget>`
|
||||||
} else if (item.fallback) {
|
} else if (item.fallback) {
|
||||||
const fallback = theme.data.widgets[item.fallback]
|
const fallback = theme.widgets[item.fallback]
|
||||||
el += partial(fallback.layout, {item: fallback})
|
el += partial(fallback.layout, {item: fallback})
|
||||||
}
|
}
|
||||||
return el
|
return el
|
||||||
|
|
|
@ -24,7 +24,7 @@ function layoutArchiveList() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
for (let year of years) {
|
for (let year of years) {
|
||||||
el += `<article class="${scrollreveal()}" id="archive">`
|
el += `<article class="${scrollreveal('')}" id="archive">`
|
||||||
el += `<div class='archive-header h4'>${year}</div>`
|
el += `<div class='archive-header h4'>${year}</div>`
|
||||||
site.posts.sort('date', -1).filter(function (post) {
|
site.posts.sort('date', -1).filter(function (post) {
|
||||||
post.year = date(post.date, 'YYYY')
|
post.year = date(post.date, 'YYYY')
|
||||||
|
|
|
@ -9,7 +9,7 @@ if (page.menu_id == undefined) {
|
||||||
<% page.layout = 'categories'; %>
|
<% page.layout = 'categories'; %>
|
||||||
<%- partial('_partial/main/navbar/nav_tabs_blog') %>
|
<%- partial('_partial/main/navbar/nav_tabs_blog') %>
|
||||||
<div class='post-list'>
|
<div class='post-list'>
|
||||||
<article class='<%- scrollreveal() %>' id='cats'>
|
<article class='<%- scrollreveal("") %>' id='cats'>
|
||||||
<% site.categories.sort('path').each(function(category){ %>
|
<% site.categories.sort('path').each(function(category){ %>
|
||||||
<div>
|
<div>
|
||||||
<a class="<%= category.parent ? 'cat child' : 'cat'%>" href="<%= url_for(category.path) %>">
|
<a class="<%= category.parent ? 'cat child' : 'cat'%>" href="<%= url_for(category.path) %>">
|
||||||
|
|
|
@ -12,7 +12,7 @@ function layout_post_card(layout, post, content) {
|
||||||
if (layout == 'post' && post.cover != undefined && post.poster != undefined) {
|
if (layout == 'post' && post.cover != undefined && post.poster != undefined) {
|
||||||
layout += ' photo';
|
layout += ' photo';
|
||||||
}
|
}
|
||||||
el += '<a class="post-card ' + layout + ' ' + scrollreveal() + '" href="' + url_for(post.link || post.path) + '">';
|
el += `<a class="post-card${scrollreveal(' ')} ${layout}" href="${url_for(post.link || post.path)}">`
|
||||||
el += content;
|
el += content;
|
||||||
el += '</a>';
|
el += '</a>';
|
||||||
return el;
|
return el;
|
||||||
|
|
|
@ -8,7 +8,7 @@ function layout_topic_list(partial) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
el += `<div class="post-list wiki topic">`
|
el += `<div class="post-list wiki topic">`
|
||||||
el += `<a class="post-card wiki topic ${scrollreveal()}" href="${url_for(topic.homepage?.path || '/')}">`
|
el += `<a class="post-card wiki topic${scrollreveal(' ')}" href="${url_for(topic.homepage?.path || '/')}">`
|
||||||
el += partial(topic)
|
el += partial(topic)
|
||||||
el += `</a>`
|
el += `</a>`
|
||||||
el += `</div>`
|
el += `</div>`
|
||||||
|
|
|
@ -13,14 +13,14 @@ function layout_wiki_list(partial) {
|
||||||
if (page.filter === false) {
|
if (page.filter === false) {
|
||||||
// wikiList
|
// wikiList
|
||||||
el += `<div class="post-list wiki">`
|
el += `<div class="post-list wiki">`
|
||||||
el += `<a class="post-card wiki ${scrollreveal()}" href="${url_for(proj.homepage?.path || '/')}">`
|
el += `<a class="post-card wiki${scrollreveal(' ')}" href="${url_for(proj.homepage?.path || '/')}">`
|
||||||
el += partial(proj)
|
el += partial(proj)
|
||||||
el += `</a>`
|
el += `</a>`
|
||||||
el += `</div>`
|
el += `</div>`
|
||||||
} else if (proj.tags && proj.tags.includes(page.tagName) === true) {
|
} else if (proj.tags && proj.tags.includes(page.tagName) === true) {
|
||||||
// filtered wikiList
|
// filtered wikiList
|
||||||
el += `<div class="post-list wiki filter">`
|
el += `<div class="post-list wiki filter">`
|
||||||
el += `<a class="post-card wiki ${scrollreveal()}" href="${url_for(proj.homepage?.path || '/')}">`
|
el += `<a class="post-card wiki${scrollreveal(' ')}" href="${url_for(proj.homepage?.path || '/')}">`
|
||||||
el += partial(proj)
|
el += partial(proj)
|
||||||
el += `</a>`
|
el += `</a>`
|
||||||
el += `</div>`
|
el += `</div>`
|
||||||
|
|
|
@ -15,11 +15,11 @@ if (page.type?.length > 0) {
|
||||||
var indent = false
|
var indent = false
|
||||||
if (page.indent != null) {
|
if (page.indent != null) {
|
||||||
indent = page.indent
|
indent = page.indent
|
||||||
} else if (page.topic && theme.topic.tree[page.topic] && (theme.topic.tree[page.topic].indent != null)) {
|
} else if (theme.topic.tree[page.topic]?.indent != null) {
|
||||||
indent = theme.topic.tree[page.topic].indent
|
indent = theme.topic.tree[page.topic]?.indent
|
||||||
} else if (page.wiki && theme.wiki.tree[page.wiki] && (theme.wiki.tree[page.wiki].indent != null)) {
|
} else if (theme.wiki.tree[page.wiki]?.indent != null) {
|
||||||
indent = theme.wiki.tree[page.wiki].indent
|
indent = theme.wiki.tree[page.wiki]?.indent
|
||||||
} else if (theme.article.indent) {
|
} else if (theme.article.indent != null) {
|
||||||
indent = theme.article.indent
|
indent = theme.article.indent
|
||||||
} else {
|
} else {
|
||||||
indent = article_type === 'story'
|
indent = article_type === 'story'
|
||||||
|
@ -32,7 +32,6 @@ html += `<html lang="${page.lang}">`
|
||||||
html += partial('_partial/cover/index')
|
html += partial('_partial/cover/index')
|
||||||
html += `<div class="l_body ${page_type} ${article_type}" id="start" layout="${page.layout}" ${indent ? 'text-indent' : ''}>`
|
html += `<div class="l_body ${page_type} ${article_type}" id="start" layout="${page.layout}" ${indent ? 'text-indent' : ''}>`
|
||||||
html += `<aside class="l_left">`
|
html += `<aside class="l_left">`
|
||||||
// html += `<img no-lazy class="sidebar-bg" src="${theme.style.sidebar.background}">`
|
|
||||||
html += `<div class="sidebar-container${theme.style.sidebar?.blur ? ' sidebar-blur' : ''}">`
|
html += `<div class="sidebar-container${theme.style.sidebar?.blur ? ' sidebar-blur' : ''}">`
|
||||||
html += partial('_partial/sidebar/index')
|
html += partial('_partial/sidebar/index')
|
||||||
html += `</div>`
|
html += `</div>`
|
||||||
|
|
|
@ -1,28 +1,70 @@
|
||||||
<%
|
<%
|
||||||
function layoutTitle() {
|
const { layout } = page
|
||||||
const title = page.h1 != null ? page.h1 : page.title;
|
// 是否使用 Heti 布局插件
|
||||||
if (title && title.length > 0) {
|
const isUsingHeti = theme.plugins.heti && theme.plugins.heti.enable
|
||||||
return '<h1 class="article-title"><span>' + title + '</span></h1>';
|
// 是否使用 TianliGPT 插件
|
||||||
|
const isUsingTianliGPT = theme.plugins.tianli_gpt.enable && ['all', page.layout].includes(theme.plugins.tianli_gpt.field)
|
||||||
|
|
||||||
|
// 默认的 menu_id
|
||||||
|
if (page.menu_id == null) {
|
||||||
|
if (page.wiki) {
|
||||||
|
page.menu_id = 'wiki'
|
||||||
} else {
|
} else {
|
||||||
return '';
|
page.menu_id = 'post'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 默认的 title
|
||||||
|
if (page.title == null) {
|
||||||
|
if (page.wiki) {
|
||||||
|
page.title = __('btn.wiki')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function layoutTitle() {
|
||||||
|
const title = page.h1 != null ? page.h1 : page.title
|
||||||
|
if (title && title.length > 0) {
|
||||||
|
return `<h1 class="article-title"><span>${title}</span></h1>`
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function articleClass() {
|
||||||
|
var str = `md-text content${scrollreveal(' ')}`
|
||||||
|
if (isUsingHeti) {
|
||||||
|
str += ' heti'
|
||||||
|
}
|
||||||
|
if (isUsingTianliGPT) {
|
||||||
|
str += ' '
|
||||||
|
}
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
|
||||||
function layoutDiv() {
|
function layoutDiv() {
|
||||||
var el = '';
|
var el = ''
|
||||||
if (page.nav_tabs) {
|
if (page.nav_tabs) {
|
||||||
el += partial('_partial/main/navbar/nav_tabs_blog');
|
el += partial('_partial/main/navbar/nav_tabs_blog')
|
||||||
}
|
}
|
||||||
if (page.h1 || page.title || (page.content && page.content.length > 0)) {
|
if (page.h1 || page.title || (page.content && page.content.length > 0)) {
|
||||||
el += partial('_partial/main/navbar/breadcrumb');
|
el += partial('_partial/main/navbar/breadcrumb')
|
||||||
}
|
}
|
||||||
el += '<article class="md-text content ' + page.layout + scrollreveal() + '">';
|
el += `<article class="${articleClass()}">`
|
||||||
el += layoutTitle();
|
el += layoutTitle()
|
||||||
if (page.content && page.content.length > 0) {
|
if (page.content && page.content.length > 0) {
|
||||||
el += page.content;
|
el += page.content
|
||||||
}
|
}
|
||||||
el += '</article>';
|
if (layout === 'post') {
|
||||||
el += partial('_partial/plugins/comments/layout');
|
el += partial('_partial/main/article/article_footer')
|
||||||
return el;
|
}
|
||||||
|
el += `</article>`
|
||||||
|
if (layout === 'post' || page.wiki) {
|
||||||
|
el += partial('_partial/main/article/read_next')
|
||||||
|
}
|
||||||
|
if (layout === 'post') {
|
||||||
|
el += partial('_partial/main/article/related_posts')
|
||||||
|
}
|
||||||
|
el += partial('_partial/plugins/comments/layout')
|
||||||
|
return el
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
<%
|
|
||||||
if (page.menu_id == undefined) {
|
|
||||||
page.menu_id = 'post';
|
|
||||||
}
|
|
||||||
if (page.header == undefined) {
|
|
||||||
page.header = false;
|
|
||||||
}
|
|
||||||
function layoutTitle() {
|
|
||||||
const title = page.h1 != null ? page.h1 : page.title;
|
|
||||||
if (title && title.length > 0) {
|
|
||||||
return '<h1 class="article-title"><span>' + title + '</span></h1>';
|
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let post = page;
|
|
||||||
let heti = '';
|
|
||||||
if (theme.plugins.heti && theme.plugins.heti.enable) {
|
|
||||||
heti = ' heti';
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
<%- partial('_partial/main/navbar/breadcrumb') %>
|
|
||||||
<article class='md-text content<%- heti %> <%- post.layout %><%- scrollreveal() %>'>
|
|
||||||
<%- layoutTitle() %>
|
|
||||||
<%- post.content %>
|
|
||||||
<% if (theme.plugins.tianli_gpt.enable && ['all', 'post'].includes(theme.plugins.tianli_gpt.field)) { %>
|
|
||||||
<%- partial('_partial/plugins/ai/tianli_gpt') %>
|
|
||||||
<% } %>
|
|
||||||
<%- partial('_partial/main/article/article_footer') %>
|
|
||||||
</article>
|
|
||||||
<%- partial('_partial/main/article/read_next') %>
|
|
||||||
<%- partial('_partial/main/article/related_posts') %>
|
|
||||||
<%- partial('_partial/plugins/comments/layout') %>
|
|
|
@ -9,7 +9,7 @@ if (page.menu_id == undefined) {
|
||||||
<% page.layout = 'tags'; %>
|
<% page.layout = 'tags'; %>
|
||||||
<%- partial('_partial/main/navbar/nav_tabs_blog') %>
|
<%- partial('_partial/main/navbar/nav_tabs_blog') %>
|
||||||
<div class='post-list'>
|
<div class='post-list'>
|
||||||
<article class='<%- scrollreveal() %>' id='tags'>
|
<article class='<%- scrollreveal("") %>' id='tags'>
|
||||||
<% site.tags.sort('length', -1).each(function(tag){ %>
|
<% site.tags.sort('length', -1).each(function(tag){ %>
|
||||||
<a class='tag' href="<%= url_for(tag.path) %>">
|
<a class='tag' href="<%= url_for(tag.path) %>">
|
||||||
<span class='name'><%= tag.name %></span>
|
<span class='name'><%= tag.name %></span>
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
<%
|
|
||||||
if (page.menu_id == undefined) {
|
|
||||||
page.menu_id = 'wiki';
|
|
||||||
}
|
|
||||||
if (page.title == undefined) {
|
|
||||||
if (page.tagName) {
|
|
||||||
page.title = page.tagName;
|
|
||||||
} else {
|
|
||||||
page.title = __('btn.wiki');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function layoutTitle() {
|
|
||||||
const title = page.h1 != null ? page.h1 : page.title;
|
|
||||||
if (title && title.length > 0) {
|
|
||||||
return '<h1 class="article-title"><span>' + title + '</span></h1>';
|
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
|
|
||||||
<%- partial('_partial/main/navbar/breadcrumb') %>
|
|
||||||
<article class='md-text content <%- page.layout %><%- scrollreveal() %>'>
|
|
||||||
<%- layoutTitle() %>
|
|
||||||
<%- page.content %>
|
|
||||||
<% if (theme.plugins.tianli_gpt.enable && ['all', 'wiki'].includes(theme.plugins.tianli_gpt.field)) { %>
|
|
||||||
<%- partial('_partial/plugins/ai/tianli_gpt') %>
|
|
||||||
<% } %>
|
|
||||||
<%- partial('_partial/main/article/article_footer') %>
|
|
||||||
</article>
|
|
||||||
<%- partial('_partial/main/article/read_next') %>
|
|
||||||
<%- partial('_partial/plugins/comments/layout') %>
|
|
|
@ -7,57 +7,55 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path')
|
||||||
|
|
||||||
module.exports = hexo => {
|
module.exports = ctx => {
|
||||||
|
|
||||||
const { cache, language_switcher } = hexo.theme.config;
|
const { cache, language_switcher } = ctx.theme.config
|
||||||
const warning = function(...args) {
|
const warning = function(...args) {
|
||||||
hexo.log.warn(`Since ${args[0]} is turned on, the ${args[1]} is disabled to avoid potential hazards.`);
|
ctx.log.warn(`Since ${args[0]} is turned on, the ${args[1]} is disabled to avoid potential hazards.`)
|
||||||
};
|
}
|
||||||
|
|
||||||
if (cache && cache.enable && language_switcher) {
|
if (cache && cache.enable && language_switcher) {
|
||||||
warning('language_switcher', 'caching');
|
warning('language_switcher', 'caching')
|
||||||
cache.enable = false;
|
cache.enable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache && cache.enable && hexo.config.relative_link) {
|
if (cache && cache.enable && ctx.config.relative_link) {
|
||||||
warning('caching', '`relative_link` option in Hexo `_config.yml`');
|
warning('caching', '`relative_link` option in Hexo `_config.yml`')
|
||||||
hexo.config.relative_link = false;
|
ctx.config.relative_link = false
|
||||||
}
|
}
|
||||||
// hexo.config.meta_generator = false;
|
// ctx.config.meta_generator = false;
|
||||||
|
|
||||||
// merge data
|
// merge data
|
||||||
const data = hexo.locals.get('data');
|
const data = ctx.locals.get('data')
|
||||||
// merge widgets
|
// merge widgets
|
||||||
var widgets = hexo.render.renderSync({ path: path.join(hexo.theme_dir, '_data/widgets.yml'), engine: 'yaml' });
|
var widgets = ctx.render.renderSync({ path: path.join(ctx.theme_dir, '_data/widgets.yml'), engine: 'yaml' })
|
||||||
if (data.widgets) {
|
if (data.widgets) {
|
||||||
for (let i of Object.keys(data.widgets)) {
|
for (let i of Object.keys(data.widgets)) {
|
||||||
let widget = data.widgets[i];
|
let widget = data.widgets[i]
|
||||||
if (widget == null || widget.length == 0) {
|
if (widget == null || widget.length == 0) {
|
||||||
// delete
|
// delete
|
||||||
delete widgets[i];
|
delete widgets[i]
|
||||||
} else {
|
} else {
|
||||||
// create
|
// create
|
||||||
if (widgets[i] == null) {
|
if (widgets[i] == null) {
|
||||||
widgets[i] = widget;
|
widgets[i] = widget
|
||||||
} else {
|
} else {
|
||||||
// merge
|
// merge
|
||||||
for (let j of Object.keys(widget)) {
|
for (let j of Object.keys(widget)) {
|
||||||
widgets[i][j] = widget[j];
|
widgets[i][j] = widget[j]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hexo.theme.config.data == undefined) {
|
|
||||||
hexo.theme.config.data = {};
|
ctx.theme.config.widgets = widgets
|
||||||
}
|
|
||||||
hexo.theme.config.data['widgets'] = widgets;
|
|
||||||
|
|
||||||
// default menu
|
// default menu
|
||||||
if (hexo.theme.config.menu == undefined) {
|
if (ctx.theme.config.menubar == undefined) {
|
||||||
hexo.theme.config.menu = {};
|
ctx.theme.config.menubar = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ module.exports = ctx => {
|
||||||
var wiki = getWikiObject(ctx)
|
var wiki = getWikiObject(ctx)
|
||||||
const pages = ctx.locals.get('pages')
|
const pages = ctx.locals.get('pages')
|
||||||
// wiki 所有页面
|
// wiki 所有页面
|
||||||
const wiki_pages = pages.filter(p => (p.layout === 'wiki')).map(p => new WikiPage(p))
|
const wiki_pages = pages.filter(p => (p.wiki != null)).map(p => new WikiPage(p))
|
||||||
const wiki_list = Object.keys(wiki.tree)
|
const wiki_list = Object.keys(wiki.tree)
|
||||||
// 上架的项目列表
|
// 上架的项目列表
|
||||||
wiki.shelf = ctx.locals.get('data').wiki || []
|
wiki.shelf = ctx.locals.get('data').wiki || []
|
||||||
|
|
|
@ -28,7 +28,8 @@ hexo.extend.generator.register('wiki', function (locals) {
|
||||||
layout: 'index_wiki',
|
layout: 'index_wiki',
|
||||||
menu_id: site_tree.wiki.menu_id,
|
menu_id: site_tree.wiki.menu_id,
|
||||||
filter: true,
|
filter: true,
|
||||||
tagName: tag.name
|
tagName: tag.name,
|
||||||
|
title: tag.name
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
hexo.extend.helper.register('scrollreveal', function(args){
|
hexo.extend.helper.register('scrollreveal', function(args) {
|
||||||
const cfg = hexo.theme.config;
|
if (hexo.theme.config.plugins.scrollreveal?.enable) {
|
||||||
if (cfg.plugins.scrollreveal && cfg.plugins.scrollreveal.enable) {
|
return `${args ? args : ''}slide-up`
|
||||||
return ' reveal';
|
} else {
|
||||||
|
return ''
|
||||||
}
|
}
|
||||||
return '';
|
})
|
||||||
});
|
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
transform: translateX(-320px)
|
transform: translateX(-320px)
|
||||||
margin: 0
|
margin: 0
|
||||||
left: 8px
|
left: 8px
|
||||||
background: var(--site-bg)
|
|
||||||
box-shadow: $boxshadow-card-float
|
box-shadow: $boxshadow-card-float
|
||||||
z-index: 10
|
z-index: 10
|
||||||
.l_main
|
.l_main
|
||||||
|
|
|
@ -14,12 +14,6 @@
|
||||||
background-size: cover
|
background-size: cover
|
||||||
if hexo-config('style.sidebar.background')
|
if hexo-config('style.sidebar.background')
|
||||||
background-image: convert(hexo-config('style.sidebar.background'))
|
background-image: convert(hexo-config('style.sidebar.background'))
|
||||||
.sidebar-bg
|
|
||||||
position absolute
|
|
||||||
width: 100%
|
|
||||||
height: 100%
|
|
||||||
object-fit: cover
|
|
||||||
background: var(--text-meta)
|
|
||||||
.sidebar-container
|
.sidebar-container
|
||||||
height: 100%
|
height: 100%
|
||||||
display: flex
|
display: flex
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
.reveal
|
.slide-up
|
||||||
visibility: hidden
|
visibility: hidden
|
|
@ -197,13 +197,16 @@ init.registerTabsTag()
|
||||||
// scrollreveal
|
// scrollreveal
|
||||||
if (stellar.plugins.scrollreveal) {
|
if (stellar.plugins.scrollreveal) {
|
||||||
stellar.loadScript(stellar.plugins.scrollreveal.js).then(function () {
|
stellar.loadScript(stellar.plugins.scrollreveal.js).then(function () {
|
||||||
ScrollReveal().reveal("body .reveal", {
|
const slideUp = {
|
||||||
distance: stellar.plugins.scrollreveal.distance,
|
distance: stellar.plugins.scrollreveal.distance,
|
||||||
duration: stellar.plugins.scrollreveal.duration,
|
duration: stellar.plugins.scrollreveal.duration,
|
||||||
interval: stellar.plugins.scrollreveal.interval,
|
interval: stellar.plugins.scrollreveal.interval,
|
||||||
scale: stellar.plugins.scrollreveal.scale,
|
scale: stellar.plugins.scrollreveal.scale,
|
||||||
|
opacity: 0,
|
||||||
easing: "ease-out"
|
easing: "ease-out"
|
||||||
});
|
}
|
||||||
|
ScrollReveal().reveal('.l_left .slide-up', slideUp)
|
||||||
|
ScrollReveal().reveal('.l_main .slide-up', slideUp)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue