Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gitalk comment system #464

Merged
merged 10 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -541,20 +541,13 @@ gitment:
# 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: true
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
## CDN for Gitalk
gitalk_cdn_prefix: https://unpkg.com/gitalk/dist/
# gitalk_cdn_prefix: https://cdn.bootcss.com/gitalk/1.4.0/
# gitalk_cdn_prefix: https://cdnjs.cloudflare.com/ajax/libs/gitalk/1.4.0/
## CDN for MD5
md5_cdn: https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.10.0/js/md5.min.js
# md5CDN: https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js

# Baidu Share
# Available value:
Expand Down Expand Up @@ -1028,6 +1021,19 @@ vendors:
# Example: https://cdn.jsdelivr.net/npm/[email protected]/dist/Valine.min.js
valine:

# Internal version:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason not to include a internal version of gitalk?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i think need to include internal version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, both gitalk and md5 cdn source from jsDelivr now.

# See:
# Examples:
# gitalk_js: https://cdn.bootcss.com/gitalk/1.4.0/gitalk.min.js
# gitalk_css: https://cdn.bootcss.com/gitalk/1.4.0/gitalk.css
gitalk_js:
gitalk_css:

# Internal version: 2.10.0
# See: https://github.com/blueimp/JavaScript-MD5
# Example:
# md5: https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js
md5:

# Assets
css: css
Expand Down
22 changes: 19 additions & 3 deletions layout/_third-party/comments/gitalk.swig
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
{% if page.comments && theme.gitalk.enable %}
<link rel="stylesheet" href=" {{ theme.gitalk.gitalk_cdn_prefix }}gitalk.css">
<script type="text/javascript" src="{{ theme.gitalk.gitalk_cdn_prefix }}gitalk.min.js"></script>
<script type="text/javascript" src="{{ theme.gitalk.md5_cdn }}"></script>

{% set gitalk_js_url = "//cdn.bootcss.com/gitalk/1.4.0/gitalk.min.js" %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to #105, it will be better to use jsDelivr as default cdn.

{% if theme.vendors.gitalk_js %}
{% set gitalk_js_url = theme.vendors.gitalk_js %}
{% endif %}
<script type="text/javascript" src="{{ gitalk_js_url }}"></script>

{% set gitalk_css_url = "//cdn.bootcss.com/gitalk/1.4.0/gitalk.css" %}
{% if theme.vendors.gitalk_css %}
{% set gitalk_css_url = theme.vendors.gitalk_css %}
{% endif %}
<link rel="stylesheet" href="{{ gitalk_css_url }}">

{% set md5_url = "//cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js" %}
{% if theme.vendors.md5 %}
{% set md5_url = theme.vendors.md5 %}
{% endif %}
<script type="text/javascript" src="{{ md5_url }}"></script>

<script type="text/javascript">
var gitalk = new Gitalk({
clientID: '{{ theme.gitalk.client_id }}',
Expand Down