This commit is contained in:
Cool-Y 2021-04-10 20:53:06 +08:00
parent d2982e6969
commit e3763f07c1
4 changed files with 46 additions and 1 deletions

View File

@ -408,7 +408,7 @@ valine:
# Introduction: https://imsun.net/posts/gitment-introduction/ # Introduction: https://imsun.net/posts/gitment-introduction/
# You can get your Github ID from https://api.github.com/users/<Github username> # You can get your Github ID from https://api.github.com/users/<Github username>
gitment: gitment:
enable: true enable: false
mint: true # RECOMMEND, A mint on Gitment, to support count, language and proxy_gateway mint: true # RECOMMEND, A mint on Gitment, to support count, language and proxy_gateway
count: true # Show comments count in post meta area count: true # Show comments count in post meta area
lazy: false # Comments lazy loading with a button lazy: false # Comments lazy loading with a button
@ -421,6 +421,15 @@ gitment:
proxy_gateway: # Address of api proxy, See: https://github.com/aimingoo/intersect proxy_gateway: # Address of api proxy, See: https://github.com/aimingoo/intersect
redirect_protocol: # Protocol of redirect_uri with force_redirect_protocol when mint enabled redirect_protocol: # Protocol of redirect_uri with force_redirect_protocol when mint enabled
gitalk:
enable: true
github_user: Cool-Y
github_repo: gitment-comments
client_id: 180955a2c3ae3d966d9a
client_secret: 1c5db4da72df5e6fc318d12afe5f4406f7c54343
admin: Cool-Y
distractionFreeMode: true
# Baidu Share # Baidu Share
# Available value: # Available value:
# button | slide # button | slide

View File

@ -62,6 +62,11 @@
{% endif %} {% endif %}
</div> </div>
{% elseif theme.gitalk.enable %}
<div class="comments" id="comments">
<div id="gitalk-container"></div>
</div>
{% elseif theme.valine.appid and theme.valine.appkey %} {% elseif theme.valine.appid and theme.valine.appkey %}
<div class="comments" id="comments"> <div class="comments" id="comments">
</div> </div>

View File

@ -0,0 +1,30 @@
{% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname %}
{% if theme.gitalk.enable and theme.gitalk.client_id %}
<!-- LOCAL: You can save these files to your site and update links -->
{% set CommentsClass = "Gitalk" %}
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
<!-- END LOCAL -->
{% if page.comments %}
<script type="text/javascript">
function renderGitalk(){
var gitalk = new {{CommentsClass}}({
owner: '{{ theme.gitalk.github_user }}',
repo: '{{ theme.gitalk.github_repo }}',
clientID: '{{ theme.gitalk.client_id }}',
clientSecret: '{{ theme.gitalk.client_secret }}',
admin: '{{ theme.gitalk.admin }}',
id: decodeURI(location.pathname),
{% if theme.gitalk.distractionFreeMode %}
distractionFreeMode: '{{ theme.gitalk.distractionFreeMode }}'
{% endif %}
});
gitalk.render('gitalk-container');
}
renderGitalk();
</script>
{% endif %}
{% endif %}
{% endif %}

View File

@ -6,3 +6,4 @@
{% include 'changyan.swig' %} {% include 'changyan.swig' %}
{% include 'gitment.swig' %} {% include 'gitment.swig' %}
{% include 'valine.swig' %} {% include 'valine.swig' %}
{% include 'gitalk.swig' %}