Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Commit

Permalink
Set unique id for disqus comments so they work with http:// and https://
Browse files Browse the repository at this point in the history
  • Loading branch information
michel-kraemer authored and vietj committed Mar 21, 2018
1 parent 1cf15c9 commit 4bfaa0f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
5 changes: 5 additions & 0 deletions gulpfile.js
Expand Up @@ -22,6 +22,7 @@ var rename = require("gulp-rename");
var replace = require("gulp-replace");
var request = require("request");
var serveStatic = require("serve-static");
var slug = require("slug-component");
var source = require("vinyl-source-stream");
var streamify = require("gulp-streamify");
var swig = require("swig");
Expand Down Expand Up @@ -220,6 +221,10 @@ function build(done, dev) {
return site_url + url;
},

"slug": function(title) {
return slug(title);
},

// Only for the blog page navigation.
"page": function(num) {
if (! num) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -47,6 +47,7 @@
"request": "2.55.0",
"serve-static": "^1.9.2",
"simplecrawler": "^0.5.4",
"slug-component": "^1.1.0",
"swig": "^1.4.2",
"through2": "^0.6.5",
"vinyl-source-stream": "^1.1.0"
Expand Down
21 changes: 11 additions & 10 deletions src/main/templates/post.html
Expand Up @@ -16,17 +16,18 @@ <h2 class="blog-post-title">{{title}}</h2>
<div class="row">
<div class="col-xs-12" id="disqus_thread"></div>
</div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES * * */
var disqus_shortname = 'vertx';

/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
<script>
var disqus_config = function () {
this.page.url = "{{site_url}}blog/{{title|slug}}";
this.page.identifier = "/blog/{{title|slug}}";
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://vertx.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" rel="nofollow">comments powered by Disqus.</a></noscript>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
{% include "footer.html" %}

0 comments on commit 4bfaa0f

Please sign in to comment.