添加主题自定义配置参数
This commit is contained in:
@@ -17,3 +17,14 @@
|
||||
|
||||
<script src="<%= themeConfig.domain %>/media/js/jquery.min.js" type="text/javascript"></script>
|
||||
<link rel="alternate" href="/atom.xml" title="<%= siteTitle %>" type="application/atom+xml">
|
||||
|
||||
<% if (site.customConfig.ga) { %>
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= site.customConfig.ga %>"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '<%= site.customConfig.ga %>');
|
||||
</script>
|
||||
<% } %>
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item title">
|
||||
<a href="<%= post.link %>" target="_self"><%= post.title %></a>
|
||||
<div class="word-count2"><%= post.stats.words %>字</div>
|
||||
<% if (site.customConfig.wordcount) { %>
|
||||
<div class="word-count2"><%= post.stats.words %>字</div>
|
||||
<% } %>
|
||||
<div class="date" style="color:darkgray;font-size:80%"><%= post.dateFormat %></div>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -36,9 +38,11 @@
|
||||
<% }); %>
|
||||
<h3> </h3>
|
||||
<%- include('./_blocks/pagination') %>
|
||||
<div style="text-align: right;">
|
||||
↶ <a href="/">返回首页</a>
|
||||
</div>
|
||||
<% if (site.customConfig.homeback) { %>
|
||||
<div style="text-align: right;">
|
||||
↶ <a href="/">返回首页</a>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<%- include('./_blocks/scripts') %>
|
||||
|
||||
+3
-1
@@ -57,7 +57,9 @@
|
||||
<li class="list-group-item title">
|
||||
<div class="date"><%= post.dateFormat %></div>
|
||||
<a href="<%= post.link %>" target="_self"><%= post.title %></a>
|
||||
<div class="word-count"><%= post.stats.words %>字</div>
|
||||
<% if (site.customConfig.wordcount) { %>
|
||||
<div class="word-count"><%= post.stats.words %>字</div>
|
||||
<% } %>
|
||||
</li>
|
||||
<% }); %>
|
||||
</ul>
|
||||
|
||||
+24
-6
@@ -14,12 +14,30 @@
|
||||
<h2><%= post.title %></h2>
|
||||
<%- post.content %>
|
||||
<h3> </h3>
|
||||
<% post.tags.forEach((tag) => { %>
|
||||
<a href="<%= tag.link %>">#<%= tag.name %></a>
|
||||
<% }); %>
|
||||
<div style="text-align: right;">
|
||||
↶ <a href="/">返回首页</a>
|
||||
</div>
|
||||
<% if (site.customConfig.showtag) { %>
|
||||
<% post.tags.forEach((tag) => { %>
|
||||
<a href="<%= tag.link %>">#<%= tag.name %></a>
|
||||
<% }); %>
|
||||
<% } %>
|
||||
<% if (site.customConfig.homeback) { %>
|
||||
<div style="text-align: right;">
|
||||
↶ <a href="/">返回首页</a>
|
||||
</div>
|
||||
<% } %>
|
||||
<% if (site.customConfig.twikoo) { %>
|
||||
<h3> </h3>
|
||||
<div id="tcomment"></div>
|
||||
<script src="https://cdn.staticfile.org/twikoo/<%= site.customConfig.tversion %>/twikoo.all.min.js"></script>
|
||||
<script>
|
||||
twikoo.init({
|
||||
envId: '<%= site.customConfig.twikoo %>', // 腾讯云环境填 envId;Vercel 环境填地址(https://xxx.vercel.app)
|
||||
el: '#tcomment', // 容器元素
|
||||
// region: 'ap-guangzhou', // 环境地域,默认为 ap-shanghai,腾讯云环境填 ap-shanghai 或 ap-guangzhou;Vercel 环境不填
|
||||
// path: location.pathname, // 用于区分不同文章的自定义 js 路径,如果您的文章路径不是 location.pathname,需传此参数
|
||||
lang: 'zh-CN', // 用于手动设定评论区语言,支持的语言列表 https://github.com/imaegoo/twikoo/blob/main/src/client/utils/i18n/index.js
|
||||
})
|
||||
</script>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
<%- include('./_blocks/scripts') %>
|
||||
|
||||
+8
-4
@@ -16,16 +16,20 @@
|
||||
<ul class="list-group">
|
||||
<% posts.forEach(function(post) { %>
|
||||
<li class="list-group-item title"><a href="<%= post.link %>" target="_self"><%= post.title %></a>
|
||||
<div class="word-count2"><%= post.stats.words %>字</div>
|
||||
<% if (site.customConfig.wordcount) { %>
|
||||
<div class="word-count2"><%= post.stats.words %>字</div>
|
||||
<% } %>
|
||||
<div class="date" style="color:darkgray;font-size:80%"><%= post.dateFormat %></div>
|
||||
</li>
|
||||
<% }); %>
|
||||
</ul>
|
||||
<h3> </h3>
|
||||
<%- include('./_blocks/pagination') %>
|
||||
<div style="text-align: right;">
|
||||
↶ <a href="/tags/">标签云</a>
|
||||
</div>
|
||||
<% if (site.customConfig.homeback) { %>
|
||||
<div style="text-align: right;">
|
||||
↶ <a href="/tags/">标签云</a>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+15
-10
@@ -38,16 +38,20 @@
|
||||
<% }); %>
|
||||
</ul>
|
||||
<h3> </h3>
|
||||
<p id="hitokoto">
|
||||
<% if (site.customConfig.hitokoto) { %>
|
||||
<p id="hitokoto">
|
||||
<div id="hitokoto_text" style="font-size: 90%;"></div>
|
||||
<div id="hitokoto_from" style="font-size: 50%;"></div>
|
||||
</p>
|
||||
<div style="text-align: right;">
|
||||
↶ <a href="/">返回首页</a>
|
||||
</div>
|
||||
</p>
|
||||
<% } %>
|
||||
<% if (site.customConfig.homeback) { %>
|
||||
<div style="text-align: right;">
|
||||
↶ <a href="/">返回首页</a>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if (site.customConfig.hitokoto) { %>
|
||||
<script>
|
||||
fetch('https://v1.hitokoto.cn')
|
||||
.then(response => response.json())
|
||||
@@ -55,15 +59,16 @@
|
||||
const hitokoto = document.querySelector('#hitokoto_text')
|
||||
const from = document.querySelector('#hitokoto_from')
|
||||
//hitokoto.href = `https://hitokoto.cn/?uuid=${data.uuid}`
|
||||
if( data.from_who){
|
||||
from.innerText = '————'+ data.from_who + '「'+data.from+'」'
|
||||
}else{
|
||||
from.innerText = '————'+ '「'+data.from+'」'
|
||||
if (data.from_who) {
|
||||
from.innerText = '————' + data.from_who + '「' + data.from + '」'
|
||||
} else {
|
||||
from.innerText = '————' + '「' + data.from + '」'
|
||||
}
|
||||
hitokoto.innerText = data.hitokoto
|
||||
})
|
||||
.catch(console.error)
|
||||
</script>
|
||||
<% } %>
|
||||
<%- include('./_blocks/scripts') %>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user