2025-2-26-fixed

This commit is contained in:
2025-02-26 09:16:07 +08:00
parent bf50b6c865
commit 4968d276dc
456 changed files with 27801 additions and 1 deletions

View File

@ -0,0 +1,18 @@
<%
var parent = page.categories.filter(c => !c.parent)
if (Array.isArray(page.category_bar)) {
parent = page.categories.filter(cat => page.category_bar.indexOf(cat.name) !== -1)
}
var filterIds = page.categories.map(c => c._id)
filterIds.push(page._id)
%>
<%- partial('_partials/category-list', {
curCats : parent,
params: {
type : 'post',
filterIds: filterIds,
postLimit: theme.post.category_bar.post_limit,
postOrderBy: theme.post.category_bar.post_order_by || config.index_generator.order_by
}
}) %>

View File

@ -0,0 +1,64 @@
<% if (theme.post.copyright.enable && page.copyright !== false) { %>
<%
var license = theme.post.copyright.license || ''
if (typeof page.copyright === 'string') {
license = page.copyright
} else if (typeof page.license === 'string') {
license = page.license
}
license = license.toUpperCase()
%>
<div class="license-box my-3">
<div class="license-title">
<div><%= page.title %></div>
<div><%= decode_url(page.permalink) %></div>
</div>
<div class="license-meta">
<% if (theme.post.copyright.author.enable && (page.author || config.author)) { %>
<div class="license-meta-item">
<div><%- __('post.copyright.author') %></div>
<div><%- page.author || config.author %></div>
</div>
<% } %>
<% if (theme.post.copyright.post_date.enable && page.date) { %>
<div class="license-meta-item license-meta-date">
<div><%- __('post.copyright.posted') %></div>
<div><%= full_date(page.date, theme.post.copyright.post_date.format || 'LL') %></div>
</div>
<% } %>
<% if (theme.post.copyright.update_date.enable && page.updated && compare_date(page.date, page.updated)) { %>
<div class="license-meta-item license-meta-date">
<div><%- __('post.copyright.updated') %></div>
<div><%= full_date(page.updated, theme.post.copyright.update_date.format || 'LL') %></div>
</div>
<% } %>
<% if (license) { %>
<div class="license-meta-item">
<div><%- __('post.copyright.licensed') %></div>
<div>
<% if (['BY', 'BY-SA', 'BY-ND', 'BY-NC', 'BY-NC-SA', 'BY-NC-ND'].indexOf(license) !== -1) { %>
<% var items = license.split('-') %>
<% for (var idx = 0; idx < items.length; idx++) { %>
<a class="print-no-link" target="_blank" href="https://creativecommons.org/licenses/<%= license.toLowerCase() %>/4.0/">
<span class="hint--top hint--rounded" aria-label="<%- __('post.copyright.' + items[idx]) %>">
<i class="iconfont icon-cc-<%= items[idx].toLowerCase() %>"></i>
</span>
</a>
<% } %>
<% } else if (license === 'ZERO') { %>
<a class="print-no-link" target="_blank" href="https://creativecommons.org/publicdomain/zero/1.0/">
<span class="hint--top hint--rounded" aria-label="<%- __('post.copyright.ZERO') %>">
<i class="iconfont icon-cc-zero"></i>
</span>
</a>
<% } else { %>
<%- license %>
<% } %>
</div>
</div>
<% } %>
</div>
<div class="license-icon iconfont"></div>
</div>
<% } %>

View File

@ -0,0 +1,16 @@
<div class="post-metas my-3">
<% if (page.categories && page.categories.length > 0) { %>
<div class="post-meta mr-3 d-flex align-items-center">
<i class="iconfont icon-category"></i>
<%- partial('_partials/category-chains', { categories: page.categories }) %>
</div>
<% } %>
<% if (page.tags && page.tags.length > 0 ) { %>
<div class="post-meta">
<i class="iconfont icon-tags"></i>
<% page.tags.each(function(tag) { %>
<a href="<%= url_for(tag.path) %>" class="print-no-link">#<%- tag.name %></a>
<% }) %>
</div>
<% } %>
</div>

View File

@ -0,0 +1,71 @@
<% if (page.meta !== false) { %>
<div class="mt-3">
<% if (theme.post.meta.author && theme.post.meta.author.enable && (page.author || config.author)) { %>
<span class="post-meta mr-2">
<i class="iconfont icon-author" aria-hidden="true"></i>
<%- page.author || config.author %>
</span>
<% } %>
<% if (theme.post.meta.date.enable) { %>
<span class="post-meta">
<i class="iconfont icon-date-fill" aria-hidden="true"></i>
<time datetime="<%= full_date(page.date, 'YYYY-MM-DD HH:mm') %>" pubdate>
<%= full_date(page.date, theme.post.meta.date.format) %>
</time>
</span>
<% } %>
</div>
<div class="mt-1">
<% if (theme.post.meta.wordcount.enable) { %>
<span class="post-meta mr-2">
<i class="iconfont icon-chart"></i>
<% if (theme.post.meta.wordcount.format) { %>
<!-- compatible with older versions-->
<%- theme.post.meta.wordcount.format.replace('{}', wordcount(page)) %>
<% } else { %>
<%- __('post.meta.wordcount', wordcount(page)) %>
<% } %>
</span>
<% } %>
<% if (theme.post.meta.min2read.enable) { %>
<span class="post-meta mr-2">
<i class="iconfont icon-clock-fill"></i>
<% var awl = parseInt(theme.post.meta.min2read.awl, 10) %>
<% var wpm = parseInt(theme.post.meta.min2read.wpm, 10) %>
<% if (theme.post.meta.min2read.format) { %>
<!-- compatible with older versions-->
<%- theme.post.meta.min2read.format.replace('{}', min2read(page, { awl: awl, wpm: wpm })) %>
<% } else { %>
<%- __('post.meta.min2read', min2read(page, { awl: awl, wpm: wpm })) %>
<% } %>
</span>
<% } %>
<% var views_texts = (theme.post.meta.views.format || __('post.meta.views')).split('{}') %>
<% if (theme.post.meta.views.enable && views_texts.length >= 2) { %>
<% if (theme.post.meta.views.source === 'leancloud') { %>
<span id="leancloud-page-views-container" class="post-meta" style="display: none">
<i class="iconfont icon-eye" aria-hidden="true"></i>
<%- views_texts[0] %><span id="leancloud-page-views"></span><%- views_texts[1] %>
</span>
<% import_js(theme.static_prefix.internal_js, 'leancloud.js', 'defer') %>
<% } else if (theme.post.meta.views.source === 'busuanzi') { %>
<span id="busuanzi_container_page_pv" style="display: none">
<i class="iconfont icon-eye" aria-hidden="true"></i>
<%- views_texts[0] %><span id="busuanzi_value_page_pv"></span><%- views_texts[1] %>
</span>
<% import_js(theme.static_prefix.busuanzi, 'busuanzi.pure.mini.js', 'defer') %>
<% } else if (theme.post.meta.views.source === 'umami') { %>
<span id="umami-page-views-container" class="post-meta" style="display: none">
<i class="iconfont icon-eye" aria-hidden="true"></i>
<%- views_texts[0] %><span id="umami-page-views"></span><%- views_texts[1] %>
</span>
<% import_js(theme.static_prefix.internal_js, 'umami-view.js', 'defer') %>
<% } %>
<% } %>
</div>
<% } %>

View File

@ -0,0 +1,10 @@
<% if(theme.post.toc.enable && theme.post.toc.placement === 'left' && page.toc !== false){ %>
<aside class="sidebar" style="padding-left: 2rem; margin-right: -1rem">
<%- partial('_partials/post/toc') %>
</aside>
<% } else if (theme.post.category_bar.enable && theme.post.category_bar.placement !== 'right' && !page.hide &&
(!theme.post.category_bar.specific || (theme.post.category_bar.specific && page.category_bar))) { %>
<aside class="sidebar category-bar" style="margin-right: -1rem">
<%- partial('_partials/post/category-bar') %>
</aside>
<% } %>

View File

@ -0,0 +1,10 @@
<% if(theme.post.toc.enable && theme.post.toc.placement !== 'left' && page.toc !== false){ %>
<aside class="sidebar" style="margin-left: -1rem">
<%- partial('_partials/post/toc') %>
</aside>
<% } else if (theme.post.category_bar.enable && theme.post.category_bar.placement === 'right' && !page.hide &&
(!theme.post.category_bar.specific || (theme.post.category_bar.specific && page.category_bar))) { %>
<aside class="sidebar category-bar" style="margin-left: -1rem">
<%- partial('_partials/post/category-bar') %>
</aside>
<% } %>

View File

@ -0,0 +1,49 @@
<div id="toc">
<p class="toc-header">
<i class="iconfont icon-list"></i>
<span><%- __('post.toc') %></span>
</p>
<div class="toc-body" id="toc-body"></div>
</div>
<%
import_script(`
<script>
Fluid.utils.createScript('${url_join(theme.static_prefix.tocbot, 'tocbot.min.js')}', function() {
var toc = jQuery('#toc');
if (toc.length === 0 || !window.tocbot) { return; }
var boardCtn = jQuery('#board-ctn');
var boardTop = boardCtn.offset().top;
window.tocbot.init(Object.assign({
tocSelector : '#toc-body',
contentSelector : '.markdown-body',
linkClass : 'tocbot-link',
activeLinkClass : 'tocbot-active-link',
listClass : 'tocbot-list',
isCollapsedClass: 'tocbot-is-collapsed',
collapsibleClass: 'tocbot-is-collapsible',
scrollSmooth : true,
includeTitleTags: true,
headingsOffset : -boardTop,
}, CONFIG.toc));
if (toc.find('.toc-list-item').length > 0) {
toc.css('visibility', 'visible');
}
Fluid.events.registerRefreshCallback(function() {
if ('tocbot' in window) {
tocbot.refresh();
var toc = jQuery('#toc');
if (toc.length === 0 || !tocbot) {
return;
}
if (toc.find('.toc-list-item').length > 0) {
toc.css('visibility', 'visible');
}
}
});
});
</script>
`)
%>