Skip to content

Commit

Permalink
Remove disqus if not on blog post
Browse files Browse the repository at this point in the history
  • Loading branch information
kakawait committed Nov 13, 2016
1 parent f8435d4 commit 61c2ae0
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions layouts/partials/script.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,33 @@
});
});
</script>
{{ if not (eq .Params.comments false) }}
{{ if .Site.DisqusShortname }}
<script>
var disqus_config = function () {
this.page.url = '{{ .Permalink }}';
{{ if .Params.disqusIdentifier }}
this.page.identifier = '{{ .Params.disqusIdentifier }}';
{{ else }}
this.page.identifier = '{{ .URL | relURL }}'
{{ end }}
};
(function() {
// Don't ever inject Disqus on localhost--it creates unwanted
// discussions from 'localhost:1313' on your Disqus account...
if (window.location.hostname == "localhost") {
return;
}
var d = document, s = d.createElement('script');
var disqus_shortname = '{{ .Site.DisqusShortname }}';
s.src = '//' + disqus_shortname + '.disqus.com/embed.js';
{{ if .IsPage }}
{{ if not (eq .Params.comments false) }}
{{ if .Site.DisqusShortname }}
<script>
var disqus_config = function () {
this.page.url = '{{ .Permalink }}';
{{ if .Params.disqusIdentifier }}
this.page.identifier = '{{ .Params.disqusIdentifier }}';
{{ else }}
this.page.identifier = '{{ .URL | relURL }}'
{{ end }}
};
(function() {
// Don't ever inject Disqus on localhost--it creates unwanted
// discussions from 'localhost:1313' on your Disqus account...
if (window.location.hostname == "localhost") {
return;
}
var d = document, s = d.createElement('script');
var disqus_shortname = '{{ .Site.DisqusShortname }}';
s.src = '//' + disqus_shortname + '.disqus.com/embed.js';

s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
{{ end }}
{{ end }}
{{ end }}
{{ if $.Site.Params.swiftype_install_key }}
Expand Down

0 comments on commit 61c2ae0

Please sign in to comment.