Created
January 2, 2017 11:18
-
-
Save fuka/7b49d083e1c942371584c78a60e8c0d8 to your computer and use it in GitHub Desktop.
HugoにDiqsusを導入するためのコード片
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disqus | |
disqusShortname = "backport" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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