diff --git a/_config.yml b/_config.yml index 294f1164b3..f72ee1fffc 100644 --- a/_config.yml +++ b/_config.yml @@ -556,6 +556,18 @@ gitment: 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 +# Gitalk +# Demo: https://gitalk.github.io +# Reference: https://asdfv1929.github.io/2018/01/20/gitalk/, https://liujunzhou.cn/2018/8/10/gitalk-error/#more +gitalk: + enable: false + github_id: # Github repo owner + repo: # Repository name to store issues. + client_id: # Github Application Client ID + client_secret: # Github Application Client Secret + admin_user: # GitHub repo owner and collaborators, only these guys can initialize github issues + distraction_free_mode: true # Facebook-like distraction free mode + # Baidu Share # Available value: # button | slide @@ -1031,6 +1043,19 @@ vendors: # valine: //cdnjs.cloudflare.com/ajax/libs/valine/1.3.3/Valine.min.js valine: + # Internal version: 1.4.0 + # See: https://github.com/gitalk/gitalk + # Examples: + # gitalk_js: https://cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.min.js + # gitalk_css: https://cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.css + gitalk_js: + gitalk_css: + + # Internal version: 0.7.3 + # See: https://github.com/emn178/js-md5/ + # Example: + # md5: https://cdn.jsdelivr.net/npm/js-md5@0.7.3/src/md5.min.js + md5: # Assets css: css diff --git a/layout/_partials/comments.swig b/layout/_partials/comments.swig index 07d3fa56ff..eb7d40ae22 100644 --- a/layout/_partials/comments.swig +++ b/layout/_partials/comments.swig @@ -47,6 +47,11 @@ {% elseif theme.valine.enable and theme.valine.appid and theme.valine.appkey %}
+ + {% elseif theme.gitalk.enable %} +
+
+ {% endif %} {% endif %} diff --git a/layout/_third-party/comments/gitalk.swig b/layout/_third-party/comments/gitalk.swig new file mode 100644 index 0000000000..265578b811 --- /dev/null +++ b/layout/_third-party/comments/gitalk.swig @@ -0,0 +1,33 @@ +{% if page.comments && theme.gitalk.enable %} + + {% set gitalk_js_url = "//cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.min.js" %} + {% if theme.vendors.gitalk_js %} + {% set gitalk_js_url = theme.vendors.gitalk_js %} + {% endif %} + + + {% set gitalk_css_url = "//cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.css" %} + {% if theme.vendors.gitalk_css %} + {% set gitalk_css_url = theme.vendors.gitalk_css %} + {% endif %} + + + {% set md5_url = "//cdn.jsdelivr.net/npm/js-md5@0.7.3/src/md5.min.js" %} + {% if theme.vendors.md5 %} + {% set md5_url = theme.vendors.md5 %} + {% endif %} + + + +{% endif %} \ No newline at end of file diff --git a/layout/_third-party/comments/index.swig b/layout/_third-party/comments/index.swig index f5ebccba40..0812777665 100644 --- a/layout/_third-party/comments/index.swig +++ b/layout/_third-party/comments/index.swig @@ -3,3 +3,4 @@ {% include 'changyan.swig' %} {% include 'gitment.swig' %} {% include 'valine.swig' %} +{% include 'gitalk.swig' %} \ No newline at end of file diff --git a/source/css/_common/components/third-party/gitalk.styl b/source/css/_common/components/third-party/gitalk.styl new file mode 100644 index 0000000000..fed0206821 --- /dev/null +++ b/source/css/_common/components/third-party/gitalk.styl @@ -0,0 +1,4 @@ +.gt-header a, .gt-comments a, .gt-popup a + border-bottom: none; +.gt-container .gt-popup .gt-action.is--active:before + top: 0.7em; \ No newline at end of file diff --git a/source/css/_common/components/third-party/third-party.styl b/source/css/_common/components/third-party/third-party.styl index cb14c9f4d2..2a0fc6abcb 100644 --- a/source/css/_common/components/third-party/third-party.styl +++ b/source/css/_common/components/third-party/third-party.styl @@ -5,3 +5,4 @@ @import "algolia-search" if hexo-config('algolia_search.enable'); @import "needsharebutton" if hexo-config('needmoreshare2.enable'); @import "related-posts" if hexo-config('related_posts.enable'); +@import "gitalk" if hexo-config('gitalk.enable');