添加主题自定义配置参数
This commit is contained in:
+36
-83
@@ -2,102 +2,55 @@
|
|||||||
"name": "yinwang",
|
"name": "yinwang",
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"author": "dmxiaoshen",
|
"author": "dmxiaoshen",
|
||||||
|
"repository": "https://git.dmxiaoshen.com/dmxiaoshen/gridea-theme-yinwang",
|
||||||
"customConfig": [
|
"customConfig": [
|
||||||
{
|
{
|
||||||
"name": "sidebarWidth",
|
"name": "hitokoto",
|
||||||
"label": "菜单栏宽度",
|
"label": "是否开启Hitokoto一言",
|
||||||
"group": "布局",
|
"group": "Hitokoto一言",
|
||||||
"value": "320px",
|
"type": "switch",
|
||||||
"type": "input",
|
|
||||||
"note": "可填像素类型(如:320px)或百分比类型(如:38.2%)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "featureBorderRadius",
|
|
||||||
"label": "封面图圆角",
|
|
||||||
"group": "布局",
|
|
||||||
"value": "3px",
|
|
||||||
"type": "input",
|
|
||||||
"note": "像素类型(如:3px)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "menuColor",
|
|
||||||
"label": "菜单颜色",
|
|
||||||
"group": "颜色",
|
|
||||||
"value": "#dee2e6",
|
|
||||||
"type": "input",
|
|
||||||
"card": "color",
|
|
||||||
"note": "颜色字符串:(如:#EEEEEE、rgba(255, 255, 255, 0.9))"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "contentBgColor",
|
|
||||||
"label": "内容区背景色",
|
|
||||||
"group": "颜色",
|
|
||||||
"value": "#f8f9fa",
|
|
||||||
"type": "input",
|
|
||||||
"card": "color",
|
|
||||||
"note": "颜色字符串:(如:#EEEEEE、rgba(255, 255, 255, 0.9))"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "renderKaTeX",
|
|
||||||
"label": "是否渲染 KaTeX 公式",
|
|
||||||
"group": "渲染",
|
|
||||||
"value": false,
|
"value": false,
|
||||||
"type": "switch"
|
"note": "简单来说,一言指的就是一句话,可以是动漫中的台词,也可以是网络上的各种小段子。 或是感动,或是开心,有或是单纯的回忆。来到这里,留下你所喜欢的那一句句话,与大家分享,这就是一言存在的目的。"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "renderCode",
|
"name": "homeback",
|
||||||
"label": "是否渲染代码高亮",
|
"label": "是否显示返回首页按钮",
|
||||||
"group": "渲染",
|
"group": "返回首页按钮",
|
||||||
|
"type": "switch",
|
||||||
"value": false,
|
"value": false,
|
||||||
"type": "switch"
|
"note": "关于、标签云、文章页显示返回首页按钮"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "github",
|
"name": "showtag",
|
||||||
"label": "Github",
|
"label": "文章页是否显示标签",
|
||||||
"group": "社交",
|
"group": "文章页显示标签",
|
||||||
"value": "",
|
"type": "switch",
|
||||||
|
"value": false,
|
||||||
|
"note": "每篇文章的底部会显示该文章的标签"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "wordcount",
|
||||||
|
"label": "是否统计文章字数",
|
||||||
|
"group": "统计文章字数",
|
||||||
|
"type": "switch",
|
||||||
|
"value": false,
|
||||||
|
"note": "统计每篇文章的字数,会在首页和归档页面呈现"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "twikoo",
|
||||||
|
"label": "evnId",
|
||||||
|
"group": "Twikoo评论",
|
||||||
"type": "input",
|
"type": "input",
|
||||||
"note": "链接地址"
|
"value": "",
|
||||||
|
"note": "请正确获取到Twikoo评论系统的evnId"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "twitter",
|
"name": "tversion",
|
||||||
"label": "Twitter",
|
"label": "version",
|
||||||
"group": "社交",
|
"group": "Twikoo评论",
|
||||||
"value": "",
|
|
||||||
"type": "input",
|
"type": "input",
|
||||||
"note": "链接地址"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "weibo",
|
|
||||||
"label": "微博",
|
|
||||||
"group": "社交",
|
|
||||||
"value": "",
|
"value": "",
|
||||||
"type": "input",
|
"note": "填写Twikoo评论系统的版本"
|
||||||
"note": "链接地址"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "zhihu",
|
|
||||||
"label": "知乎",
|
|
||||||
"group": "社交",
|
|
||||||
"value": "",
|
|
||||||
"type": "input",
|
|
||||||
"note": "链接地址"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "facebook",
|
|
||||||
"label": "Facebook",
|
|
||||||
"group": "社交",
|
|
||||||
"value": "",
|
|
||||||
"type": "input",
|
|
||||||
"note": "链接地址"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "customCss",
|
|
||||||
"label": "自定义CSS",
|
|
||||||
"group": "自定义样式",
|
|
||||||
"value": "",
|
|
||||||
"type": "textarea",
|
|
||||||
"note": ""
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ga",
|
"name": "ga",
|
||||||
|
|||||||
@@ -17,3 +17,14 @@
|
|||||||
|
|
||||||
<script src="<%= themeConfig.domain %>/media/js/jquery.min.js" type="text/javascript"></script>
|
<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">
|
<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">
|
<ul class="list-group">
|
||||||
<li class="list-group-item title">
|
<li class="list-group-item title">
|
||||||
<a href="<%= post.link %>" target="_self"><%= post.title %></a>
|
<a href="<%= post.link %>" target="_self"><%= post.title %></a>
|
||||||
|
<% if (site.customConfig.wordcount) { %>
|
||||||
<div class="word-count2"><%= post.stats.words %>字</div>
|
<div class="word-count2"><%= post.stats.words %>字</div>
|
||||||
|
<% } %>
|
||||||
<div class="date" style="color:darkgray;font-size:80%"><%= post.dateFormat %></div>
|
<div class="date" style="color:darkgray;font-size:80%"><%= post.dateFormat %></div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -36,9 +38,11 @@
|
|||||||
<% }); %>
|
<% }); %>
|
||||||
<h3> </h3>
|
<h3> </h3>
|
||||||
<%- include('./_blocks/pagination') %>
|
<%- include('./_blocks/pagination') %>
|
||||||
|
<% if (site.customConfig.homeback) { %>
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
↶ <a href="/">返回首页</a>
|
↶ <a href="/">返回首页</a>
|
||||||
</div>
|
</div>
|
||||||
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%- include('./_blocks/scripts') %>
|
<%- include('./_blocks/scripts') %>
|
||||||
|
|||||||
@@ -57,7 +57,9 @@
|
|||||||
<li class="list-group-item title">
|
<li class="list-group-item title">
|
||||||
<div class="date"><%= post.dateFormat %></div>
|
<div class="date"><%= post.dateFormat %></div>
|
||||||
<a href="<%= post.link %>" target="_self"><%= post.title %></a>
|
<a href="<%= post.link %>" target="_self"><%= post.title %></a>
|
||||||
|
<% if (site.customConfig.wordcount) { %>
|
||||||
<div class="word-count"><%= post.stats.words %>字</div>
|
<div class="word-count"><%= post.stats.words %>字</div>
|
||||||
|
<% } %>
|
||||||
</li>
|
</li>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -14,12 +14,30 @@
|
|||||||
<h2><%= post.title %></h2>
|
<h2><%= post.title %></h2>
|
||||||
<%- post.content %>
|
<%- post.content %>
|
||||||
<h3> </h3>
|
<h3> </h3>
|
||||||
|
<% if (site.customConfig.showtag) { %>
|
||||||
<% post.tags.forEach((tag) => { %>
|
<% post.tags.forEach((tag) => { %>
|
||||||
<a href="<%= tag.link %>">#<%= tag.name %></a>
|
<a href="<%= tag.link %>">#<%= tag.name %></a>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
|
<% } %>
|
||||||
|
<% if (site.customConfig.homeback) { %>
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
↶ <a href="/">返回首页</a>
|
↶ <a href="/">返回首页</a>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
<%- include('./_blocks/scripts') %>
|
<%- include('./_blocks/scripts') %>
|
||||||
|
|||||||
@@ -16,16 +16,20 @@
|
|||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<% posts.forEach(function(post) { %>
|
<% posts.forEach(function(post) { %>
|
||||||
<li class="list-group-item title"><a href="<%= post.link %>" target="_self"><%= post.title %></a>
|
<li class="list-group-item title"><a href="<%= post.link %>" target="_self"><%= post.title %></a>
|
||||||
|
<% if (site.customConfig.wordcount) { %>
|
||||||
<div class="word-count2"><%= post.stats.words %>字</div>
|
<div class="word-count2"><%= post.stats.words %>字</div>
|
||||||
|
<% } %>
|
||||||
<div class="date" style="color:darkgray;font-size:80%"><%= post.dateFormat %></div>
|
<div class="date" style="color:darkgray;font-size:80%"><%= post.dateFormat %></div>
|
||||||
</li>
|
</li>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
</ul>
|
</ul>
|
||||||
<h3> </h3>
|
<h3> </h3>
|
||||||
<%- include('./_blocks/pagination') %>
|
<%- include('./_blocks/pagination') %>
|
||||||
|
<% if (site.customConfig.homeback) { %>
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
↶ <a href="/tags/">标签云</a>
|
↶ <a href="/tags/">标签云</a>
|
||||||
</div>
|
</div>
|
||||||
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -38,16 +38,20 @@
|
|||||||
<% }); %>
|
<% }); %>
|
||||||
</ul>
|
</ul>
|
||||||
<h3> </h3>
|
<h3> </h3>
|
||||||
|
<% if (site.customConfig.hitokoto) { %>
|
||||||
<p id="hitokoto">
|
<p id="hitokoto">
|
||||||
<div id="hitokoto_text" style="font-size: 90%;"></div>
|
<div id="hitokoto_text" style="font-size: 90%;"></div>
|
||||||
<div id="hitokoto_from" style="font-size: 50%;"></div>
|
<div id="hitokoto_from" style="font-size: 50%;"></div>
|
||||||
</p>
|
</p>
|
||||||
|
<% } %>
|
||||||
|
<% if (site.customConfig.homeback) { %>
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
↶ <a href="/">返回首页</a>
|
↶ <a href="/">返回首页</a>
|
||||||
</div>
|
</div>
|
||||||
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% if (site.customConfig.hitokoto) { %>
|
||||||
<script>
|
<script>
|
||||||
fetch('https://v1.hitokoto.cn')
|
fetch('https://v1.hitokoto.cn')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
@@ -64,6 +68,7 @@
|
|||||||
})
|
})
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
</script>
|
</script>
|
||||||
|
<% } %>
|
||||||
<%- include('./_blocks/scripts') %>
|
<%- include('./_blocks/scripts') %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user