Skip to content

Instantly share code, notes, and snippets.

@fuka
Created January 2, 2017 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fuka/7b49d083e1c942371584c78a60e8c0d8 to your computer and use it in GitHub Desktop.
Save fuka/7b49d083e1c942371584c78a60e8c0d8 to your computer and use it in GitHub Desktop.
HugoにDiqsusを導入するためのコード片
# Disqus
disqusShortname = "backport"
<hr />
<a class="disqus-show-comments button secondary expanded">コメント欄を表示する</a>
<div id="disqus_thread"></div>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<script>
$(document).ready(function() {
$('.disqus-show-comments').on('click', function() {
// localhostでのpreview中はDisqusをロードしない
if (window.location.hostname == "localhost") {
return;
}
// ShortNameはconfig.tomlで設定
var disqus_shortname = '{{ .Site.DisqusShortname }}';
$.ajax({
type: "GET",
url: "http://" + disqus_shortname + ".disqus.com/embed.js",
dataType: "script",
cache: true
});
$(this).fadeOut();
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment