yous / whiteglass

Minimal, responsive Jekyll theme for hackers
https://yous.github.io/whiteglass/
MIT License
732 stars 201 forks source link

Release version with comments enabled #14

Closed leonardehrenfried closed 7 years ago

leonardehrenfried commented 7 years ago

I would like to use your theme but the last release is from February and the comments code was merged in June 2017.

Any change you could throw up a release on Rubygems?

Thanks for a great theme!

yous commented 7 years ago

Oh right! Thanks for the notice. I’ll release a new version soon.

yous commented 7 years ago

Sorry for the delay, I've just released v1.4.0!

hussaintamboli commented 6 years ago

Is there any resource that I can refer to integrate my disqus with whiteglass?

yous commented 6 years ago

Hi, @hussaintamboli. First, take a look at Comments section in README.

You should get your own Disqus shortname to configure. Go to disqus.com and follow steps for "Get Started". Then you'll face "Universal Code install instructions", and there is something like s.src = 'https://SHORTNAME.disqus.com/embed.js';, then that SHORTNAME in the URL is your shortname.

After getting your shortname, overwrite _includes/custom_comments_provider.html with following content:

<div id="disqus_thread"></div>
<script>
  var disqus_config = function () {
    this.page.url = '{{ page.url | replace:'index.html','' | absolute_url }}';
    this.page.identifier = '{{ page.url | relative_url }}';
  };

  (function() {
    var d = document, s = d.createElement('script');
    s.src = 'https://SHORTNAME.disqus.com/embed.js';
    s.setAttribute('data-timestamp', + new Date());
    (d.head || d.body).appendChild(s);
  })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

This sets canonical URL to this.page.url, and relative URL to this.page.identifier. You may want to set this.page.identifier to something other, but it should be unique for each page. You should replace SHORTNAME with your own shortname.

Then add comments: true to your _config.yml to enable comments. I think you should also proceed on Disqus to finish configuration.

hussaintamboli commented 6 years ago

Works perfectly. Thanks a lot.