提交 64ba19af 编写于 作者: 折影轻梦

分析、评论系统

上级 99cfa5f1
search: https://cn.bing.com/search?q= # https://www.google.com/search?q==
order_by: date
menu:
归档: archives
关于: about.html
analytics: # 统计系统,目前支持 Google analytics.js 统计、Google Tag Manager 统计、CNZZ 统计、腾讯统计、51.La统计、百度统计
google_site_id: #<ID>
gtags_site_id: #<ID>
cnzz_site_id: #<ID>
tencent_site_id: #<ID>
la_site_id: #<ID>
baidu_site_id: #<ID>
gtm_container_id: #<ID>
comment: gitalk # 评论框,目前支持 gitalk,gitment,valine,disqus,disqusjs,changyan,livere,DiscussBot,utteranc 使用 false 可以关闭
gitalk:
admin: nexmoe # 拥有对该repo进行操作的 GitHub username
owner: nexmoe # 持有该 repo 的 GitHub username
repo: nexmoe.github.io # 存放评论的 issue 所在的 repo
clientID: 80b2453b6d5f37ad6225 # GitHub Client ID
clientSecret: 43e99fa852795c9a7b3eb924b2558c64b84bbdeb # GitHub Client Secret
gitment:
owner: nexmoe # 持有该 repo 的 GitHub username
repo: nexmoe.github.io # 存放评论的 issue 所在的 repo
clientID: 80b2453b6d5f37ad6225 # GitHub Client ID
clientSecret: 43e99fa852795c9a7b3eb924b2558c64b84bbdeb # GitHub Client Secret
valine:
appId: <API_ID> # leancloud application app id
appKey: <API_Key> # leancloud application app key
disqus:
shortname: <shortname> # 你的 Disqus shortname
disqusjs:
shortname: <shortname> # 你的 Disqus shortname
sitename: <sitename> # 你站点的名称,将会显示在「评论基础模式」的 header 中;该配置应该和 Disqus Admin - Settings - General - Website Name 一致
api: https://disqus.skk.moe/disqus/ # DisqusJS 请求的 API Endpoint,通常情况下你应该配置一个 Disqus API 的反代并填入反代的地址。你也可以直接使用 DISQUS 官方 API 的 Endpoint https://disqus.com/api/,或是使用SukkaW搭建的 Disqus API 反代 Endpoint https://disqus.skk.moe/disqus/。
apikey: <api_key> # DisqusJS 向 API 发起请求时使用的 API Key,你应该在配置 Disqus Application 时获取了 API Key;DisqusJS 支持填入一个 包含多个 API Key 的 Array,在每次请求时会随机使用其中一个;如果你只需要填入一个 API Key,则可以填入 String 或 Array。
admin: <admin> # 你的站点的 Disqus Moderator 的用户名(也就是你的用户名)。你可以在 Disqus - Settings - Account - Username 获取你的 Username
adminLabel: <adminLabel> # 你想显示在 Disqus Moderator Badge 中的文字。该配置应和 Disqus Admin - Settings - Community - Moderator Badge Text 相同
changyan:
appid: <APP_ID> # 畅言的 APPID
conf: <CONF> # 畅言的 CONF
thread_key_type: path # 可选 id 或 path
livere:
data_uid: <data_uid> # 你的来必力 UID,可以在来必力后台获取
DiscussBot:
id: <id> # 站点id
comments: 5 # 可能是限制每位用户单页面评论最多条数?
color: # 评论框主色调
dislike: 0 # 显示差评按钮
icons: 0 # 图标主题
diff: 0 # 每位用户name不同颜色
utteranc: # https://utteranc.es/
repo: [ENTER REPO HERE]
issue_term: pathname
label: Comment
theme: github-light
\ No newline at end of file
<!-- baidu Analytics -->
<script>
var _hmt = _hmt || [];
(function() {var hm = document.createElement('script');
hm.src = 'https://hm.baidu.com/hm.js?<%= theme.analytics.baidu_site_id %>';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
\ No newline at end of file
<!-- CNZZ Analytics -->
<div hidden>
<script src="//s95.cnzz.com/z_stat.php?id=<%= theme.analytics.cnzz_site_id %>&web_id=<%= theme.analytics.cnzz_site_id %>" language="JavaScript"></script>
</div>
\ No newline at end of file
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', '<%= theme.analytics.google_site_id %>', 'auto');
ga('send', 'pageview');
</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
\ No newline at end of file
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= theme.analytics.gtags_site_id %>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<%= theme.analytics.gtags_site_id %>');
</script>
\ No newline at end of file
<% if(theme.analytics.gtm_container_id) { %>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<%= theme.analytics.gtm_container_id %>"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<% } %>
\ No newline at end of file
<% if(theme.analytics.gtm_container_id) { %>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','<%= theme.analytics.gtm_container_id %>');</script>
<!-- End Google Tag Manager -->
<% } %>
\ No newline at end of file
<!-- 51.La Analytics -->
<div hidden>
<script type="text/javascript" src="https://js.users.51.la/<%= theme.analytics.la_site_id %>.js"></script>
</div>
\ No newline at end of file
<!-- Tencent Analytics -->
<script>
(function() {
var hm = document.createElement("script");
hm.src = "//tajs.qq.com/stats?sId=<%= theme.analytics.tencent_site_id %>";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
\ No newline at end of file
<style>
#nexmoe-content .nexmoe-comment {
background-color: #fff;
border-top: 20px solid #f5f6f5;
}
</style>
<script
async
src="https://comments.app/js/widget.js?2"
data-comments-app-website="<%- theme.DiscussBot.id %>"
data-limit="<%- theme.DiscussBot.comments %>"
data-color="<%- theme.DiscussBot.color %>"
data-dislikes="<%- theme.DiscussBot.dislike %>"
data-outlined="<%- theme.DiscussBot.icons %>"
data-colorful="<%- theme.DiscussBot.diff %>"
></script>
<!-- 畅言公共 js 代码 start -->
<script id="cy_cmt_num" src="https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=<%=theme.changyan.appid%>">
</script>
<!-- 畅言公共 js 代码 end -->
<!--PC和WAP自适应版-->
<div id="SOHUCS" sid="<% if(theme.changyan.thread_key_type == "id"){ %><%= page.id %><% } else { %><%= page.path %><% } %>"></div>
<script>
(function(){
var appid = '<%= theme.changyan.appid %>';
var conf = '<%= theme.changyan.conf %>';
var width = window.innerWidth || document.documentElement.clientWidth;
if (width < 960) {
window.document.write('<script id="changyan_mobile_js" charset="utf-8" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})}); } })();
</script>
\ No newline at end of file
<script id="dsq-count-scr" src="https://<%= theme.disqus.shortname %>.disqus.com/count.js" async></script>
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '<%= page.permalink %>'; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = '<%= page.permalink %>'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
</script>
<script id="disqus-thread-script">
(function() { // DON'T EDIT BELOW THIS LINE
var d = document;
var s = d.createElement('script');
s.src = '//<%= theme.disqus.shortname %>.disqus.com/embed.js';
s.setAttribute('data-timestamp', + new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<!-- Unpkg -->
<link rel="stylesheet" href="<%- theme.cdn.disqusjs.css %>">
<script src="<%- theme.cdn.disqusjs.js %>"></script>
<div id="disqus_thread"></div>
<script>
var dsqjs = new DisqusJS({
shortname: '<%= theme.disqusjs.shortname %>',
siteName: '<%= theme.disqusjs.sitename %>',
identifier: '<%= page.permalink %>',
url: '<%= page.permalink %>',
title: '<%= page.title %>',
api: '<%= theme.disqusjs.api %>',
apikey: '<%= theme.disqusjs.apikey %>',
admin: '<%= theme.disqusjs.admin %>',
adminLabel: '<%= theme.disqusjs.adminLabel %>'
});
</script>
\ No newline at end of file
<link rel="stylesheet" href="<%- theme.cdn.gitalk.css %>">
<div id="gitalk"></div>
<script src="<%- theme.cdn.gitalk.js %>"></script>
<script type="text/javascript">
var gitalk = new Gitalk({
clientID: '<%= theme.gitalk.clientID %>',
clientSecret: '<%= theme.gitalk.clientSecret %>',
id: window.location.pathname,
repo: '<%= theme.gitalk.repo %>',
owner: '<%= theme.gitalk.owner %>',
admin: '<%= theme.gitalk.admin %>'
})
gitalk.render('gitalk')
</script>
\ No newline at end of file
<div id="gitment"></div>
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
var gitment = new Gitment({
owner: '<%= theme.gitment.owner %>', // 你的 GitHub ID
repo: '<%= theme.gitment.repo %>', // 存储评论的 repo
oauth: {
client_id: '<%= theme.gitment.clientID %>', // 你的 client ID
client_secret: '<%= theme.gitment.clientSecret %>' // 你的 client secret
},
})
gitment.render('gitment')
</script>
\ No newline at end of file
<div id="lv-container" data-id="city" data-uid="<%= theme.livere.data_uid %>">
<script id="livere-comment-js">
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
j.async = true;
e.parentNode.insertBefore(j, e);
})(document, 'script');
</script>
</div>
\ No newline at end of file
<script
src="https://utteranc.es/client.js"
repo="<%= theme.utteranc.repo %>"
issue-term="<%= theme.utteranc.issue_term %>"
label="<%= theme.utteranc.label %>"
theme="<%= theme.utteranc.theme %>"
crossorigin="anonymous"
async
></script>
<div class="valine"></div>
<script src='<%- theme.cdn.valine.js %>'></script>
<script>
// 使用方法 https://valine.js.org/quickstart.html
new Valine({
el: '.valine',
appId: '<%= theme.valine.appId %>',
appKey: '<%= theme.valine.appKey %>'
})
</script>
\ No newline at end of file
<% if (theme.analytics.google_site_id) { %>
<%- partial('_analytics/google') %>
<% } %>
<% if (theme.analytics.gtags_site_id) { %>
<%- partial('_analytics/gtags') %>
<% } %>
<% if (theme.analytics.cnzz_site_id) { %>
<%- partial('_analytics/cnzz') %>
<% } %>
<% if (theme.analytics.tencent_site_id) { %>
<%- partial('_analytics/tencent') %>
<% } %>
<% if (theme.analytics.la_site_id) { %>
<%- partial('_analytics/la') %>
<% } %>
<% if (theme.analytics.baidu_site_id) { %>
<%- partial('_analytics/baidu') %>
<% } %>
\ No newline at end of file
......@@ -34,4 +34,5 @@ if (is_archive()){
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/highlight.js@9.15.8/styles/solarized-light.css"
/>
<%- js_auto_version('js/core') %>
\ No newline at end of file
<%- js_auto_version('js/core') %>
<%- partial('_partial/analytics') %>
\ No newline at end of file
......@@ -6,11 +6,11 @@
</div>
<div class="container">
<ul class="catalogue">
<% page.posts.sort(theme.order_by).each(function (page) { %>
<% page.posts.sort(theme.order_by).each(function (post) { %>
<li>
<a href="<%- url_for(page.path) %>">
<span class="title"><%= page.title %></span>
<span class="date"><span><%- date(page.date, "YYYY-MM-DD") %></span></span>
<a href="<%- url_for(post.path) %>">
<span class="title"><%= post.title %></span>
<span class="date"><span><%- date(post.date, "YYYY-MM-DD") %></span></span>
</a>
</li>
<% }) %>
......
......@@ -46,4 +46,7 @@
</nav>
</div>
</div>
<div class="container comment">
<%- theme.comment ? partial('_partial/_comment/' + theme.comment) : '' %>
</div>
</div>
\ No newline at end of file
......@@ -336,6 +336,14 @@ a:hover {
position: relative;
}
.comment {
padding: 3em 1em;
}
.comment .utterances {
max-width: 100%;
}
.footer {
padding: 2em 0;
text-align: center;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册