aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/data/themes/base/templates/comments_helper_disqus.tmpl
blob: f17777cb1261c585e22fbdd548bc4378359d6875 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## -*- coding: utf-8 -*-

<%! import json %>

<%def name="comment_form(url, title, identifier)">
    %if comment_system_id:
        <div id="disqus_thread"></div>
        <script>
        var disqus_shortname ="${comment_system_id}",
        %if url:
            disqus_url="${url}",
        %endif
        disqus_title=${json.dumps(title)},
        disqus_identifier="${identifier}",
        disqus_config = function () {
        %if lang == 'es':
            this.language = "es_ES";
        %else:
            this.language = "${lang}";
        %endif
        };
        (function() {
            var dsq = document.createElement('script'); dsq.async = true;
            dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
    <a href="https://disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
    %endif
</%def>

<%def name="comment_link(link, identifier)">
    %if comment_system_id:
    <a href="${link}#disqus_thread" data-disqus-identifier="${identifier}">${messages("Comments")}</a>
    %endif
</%def>


<%def name="comment_link_script()">
    %if comment_system_id:
       <script>var disqus_shortname="${comment_system_id}";(function(){var a=document.createElement("script");a.async=true;a.src="https://"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script>
    %endif
</%def>