-
Notifications
You must be signed in to change notification settings - Fork 484
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 Gitment comment support #456
Conversation
Well, this is my first PR on this repo. Not sure how you think about that tweak on the archive page, but showing all lowercase letter seems to be pretty odd to me. So if you feel uncomfortable with this tweak, just ignore that commit (67e7f49). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 @deamwork, thanks for this cool feature! 😄
Can you write a quick guide to enable me to test it and make sure it works with the theme please?
_config.yml
Outdated
@@ -174,6 +174,22 @@ archive_pagination: true | |||
category_pagination: true | |||
tag_pagination: true | |||
|
|||
# Gitment - A github issue comment tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uncomment these lines
layout/_partial/post/gitment.ejs
Outdated
@@ -0,0 +1 @@ | |||
<div id="gcomment"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think gitment
or gitment-comments
would be more appropriate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed as requested. :)
layout/_partial/post/actions.ejs
Outdated
<a class="post-action-btn btn btn--default" href="#gcomment"> | ||
<i class="fa fa-comment-o"></i> | ||
</a> | ||
<% } else { %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to check else if (theme.disqus_shortname || theme.duoshuo_shortname)
otherwise it will display empty elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another careless action... omg...
layout/_partial/archive-post.ejs
Outdated
@@ -34,7 +34,7 @@ | |||
<% } %> | |||
<li class="archive-post archive-day" data-date="<%= post.date.format('YYYYMMDD') %>"> | |||
<a class="archive-post-title" href="<%- url_for(post.path) %>"><%= post.title || '(' + __('post.no_title') + ')' %></a> | |||
<span class="archive-post-date"><%= ' - ' + post.date.locale(page.lang).format(__('date_format')).toLowerCase() %></span> | |||
<span class="archive-post-date"><%= ' - ' + post.date.locale(page.lang).format(__('date_format')) %></span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this and let's focus on the gitment feature :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's okay, reverted.
_config.yml
Outdated
# # Switch | ||
# enable: false | ||
# # Your Github ID here (Github username): | ||
# githubID: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use snake case in yaml file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that, I didn't even notice about that. 👍
My habit prefers CamelCase.
Pushed (83534bf), little tweaks for this merge |
Document:
You have to fill in your callback URL because your |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add Gitment in Integrated services in the user documentation? 😄
@@ -36,6 +36,33 @@ | |||
|| document.getElementsByTagName('body')[0]).appendChild(ds); | |||
})(); | |||
</script> | |||
<% } else if (theme.gitment.enable) { %> | |||
<script type="text/javascript"> | |||
(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated a bit the script to init Gitment when the gitment script is loaded because if network is slow, it will throw an error ReferenceError: Can't find variable: Gitment
(function() {
function render() {
new Gitment({
id: '<%= post.permalink %>',
owner: '<%- theme.gitment.github_id %>',
repo: '<%- theme.gitment.repo %>',
oauth: {
client_id: '<%- theme.gitment.client_id %>',
client_secret: '<%- theme.gitment.client_secret %>',
}
}).render('gitment');
}
var gc = document.createElement('script');
gc.type = 'text/javascript';
gc.src = 'http://imsun.github.io/gitment/dist/gitment.browser.js';
gc.charset = 'UTF-8';
gc.onload = render;
gc.async = true;
document.querySelector('body').appendChild(gc);
var gcs = document.createElement('link');
gcs.href = '//imsun.github.io/gitment/style/default.css';
gcs.type = 'text/css';
gcs.rel = 'stylesheet';
gcs.media = 'screen,print';
document.querySelector('head').appendChild(gcs);
})();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the doc, it works well. Very simple and powerful comment system! 😎
_config.yml
Outdated
# Repository: https://github.com/imsun/gitment | ||
# Demo: https://imsun.github.io/gitment/ | ||
# Introduction: https://imsun.net/posts/gitment-introduction/ | ||
# Quick link to setup a new Github application: https://github.com/settings/applications/new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we have multiple comment systems, let's create a section for them before Integrated services. It will be well organized.
# Comments
# You can only use one of this service
# Your Disqus shortname
disqus_shortname:
# Your Duoshuo shortname
duoshuo_shortname:
# Your Gitment information
# Read https://github.com/imsun/gitment#get-started to setup Gitment
gitment:
...
``
_config.yml
Outdated
@@ -174,6 +174,22 @@ archive_pagination: true | |||
category_pagination: true | |||
tag_pagination: true | |||
|
|||
# Gitment - A github issue comment tool. | |||
# Repository: https://github.com/imsun/gitment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just put Read https://github.com/imsun/gitment#get-started to setup Gitment
.
It will be easier to maintain (less links)
Changed as your request. 🎉 |
LGTM. Thanks buddy 😄 |
* add Gitment comment support. * tweak date display in archive page. * fix code indentation issue, update config. * Tweaks for merge. * update load script & config file change.
BTW, which commit management tool you are using? |
I just used the squash and merge feature of GitHub |
Okay, I got it. I thought it was a feature of some commit management software. |
Configuration
Changes proposed