diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/_includes/after_footer.html | 1 | ||||
-rw-r--r-- | source/_includes/disqus.html | 21 | ||||
-rw-r--r-- | source/_layouts/post.html | 4 |
3 files changed, 24 insertions, 2 deletions
diff --git a/source/_includes/after_footer.html b/source/_includes/after_footer.html index 9e4e391..cc756a0 100644 --- a/source/_includes/after_footer.html +++ b/source/_includes/after_footer.html @@ -1 +1,2 @@ +{% include disqus.html %} {% include custom/after_footer.html %}
\ No newline at end of file diff --git a/source/_includes/disqus.html b/source/_includes/disqus.html new file mode 100644 index 0000000..eb30877 --- /dev/null +++ b/source/_includes/disqus.html @@ -0,0 +1,21 @@ +{% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %} +{% if site.disqus_short_name and page.comments != false %} +<script type="text/javascript"> + var disqus_shortname = '{{ site.disqus_short_name }}'; + {% if page.comments == true %} + {% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %} + // var disqus_developer = 1; + var disqus_identifier = '{{ site.url }}{{ page.url }}'; + var disqus_url = '{{ site.url }}{{ page.url }}'; + var disqus_script = 'embed.js'; + {% else %} + {% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %} + var disqus_script = 'count.js'; + {% endif %} + (function () { + var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; + dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); + }()); +</script> +{% endif %} diff --git a/source/_layouts/post.html b/source/_layouts/post.html index fbc6ef6..fac9a41 100644 --- a/source/_layouts/post.html +++ b/source/_layouts/post.html @@ -4,7 +4,7 @@ single: true --- <article class="post">{% include article.html %}</article> -<section id="comments"> - <h3>留言</h3> +<section id="comment"> + <h1 class="title">留言</h1> <div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div> </section>
\ No newline at end of file |