Permalink
Browse files

Remove Disqus on non-blog posts.

  • Loading branch information...
nicksergeant committed Nov 2, 2016
1 parent 77ade52 commit b6cf90a41177a4083934062f78fcd51dccbd3e21
View
@@ -19,3 +19,7 @@
If you want to disable user-facing signup:
- `heroku config:set DISABLE_SIGNUP=true`
+
+If you want to enable Disqus comments:
+
+- `heroku config:set DISQUS_SHORTNAME=whatever`
@@ -21,29 +21,4 @@
{% endfor %}
{% paginate %}
</section>
- <script type="text/javascript" id="disqus">
- var disqus_shortname = '{% firstof blog_user.profile.disqus_shortname "snipt-net" %}';
- {% if debug %}
- var disqus_developer = 1;
- {% endif %}
- (function () {
- var s = document.createElement('script'); s.async = true;
- s.type = 'text/javascript';
- s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
- (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
- }());
- </script>
- <script type="text/html" id="disqus-template">
- var disqus_shortname = 'snipt-net';
- {% if debug %}
- var disqus_developer = 1;
- {% endif %}
-
- (function () {
- var s = document.createElement('script'); s.async = true;
- s.type = 'text/javascript';
- s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
- (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
- }());
- </script>
{% endblock %}
@@ -20,7 +20,7 @@
{% endwith %}
<div id="disqus_thread"></div>
<script type="text/javascript">
- var disqus_shortname = '{% firstof blog_user.profile.disqus_shortname "snipt-net" %}';
+ var disqus_shortname = '{{ blog_user.profile.disqus_shortname }}';
{% if debug %}
var disqus_developer = 1;
{% endif %}
@@ -11,7 +11,7 @@
{% endfor %}
{% paginate %}
<script type="text/javascript">
- var disqus_shortname = '{% firstof blog_user.profile.disqus_shortname "snipt-net" %}';
+ var disqus_shortname = '{{ blog_user.profile.disqus_shortname }}';
{% if debug %}
var disqus_developer = 1;
{% endif %}
@@ -37,7 +37,7 @@ <h1><a href="{{ snipt.get_full_absolute_url }}">{% firstof snipt.title 'Untitled
{% if detail %}
<div id="disqus_thread"></div>
<script type="text/javascript">
- var disqus_shortname = '{% firstof blog_user.profile.disqus_shortname "snipt-net" %}';
+ var disqus_shortname = '{{ firstof blog_user.profile.disqus_shortname }}';
{% if debug %}
var disqus_developer = 1;
{% endif %}
@@ -478,9 +478,6 @@
this.$el.removeClass('expandable');
}
- $('script#disqus').remove();
- window.site.$body.append('<script id="disqus" type="text/javascript">' + $('script#disqus-template').text() + '</script>');
-
// For new snipts.
if (this.$el.attr('id') === 'new-snipt') {
this.$el.fadeIn('fast');
@@ -77,29 +77,5 @@ <h5>Need immediate help?</h5>
</footer>
{% endfor %}
</div>
- <div id="disqus_thread">
- {% if snipt.public %}
- <script type="text/javascript">
- var disqus_shortname = 'snipt-net';
- {% if debug %}
- var disqus_developer = 1;
- {% endif %}
- var disqus_url = '{{ snipt.get_full_absolute_url }}';
- var disqus_title = '{{ snipt.title }}';
- var disqus_identifier = {{ snipt.id }};
-
- (function() {
- var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
- dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
- })();
- </script>
- {% else %}
- <p class="alert alert-info">
- <strong>Disqus comments are disabled on private snipts.</strong><br /><br />
- See <a href="https://github.com/nicksergeant/snipt/issues/53">https://github.com/nicksergeant/snipt/issues/53</a> for more information.
- </p>
- {% endif %}
- </div>
</section>
{% endblock %}
@@ -57,30 +57,4 @@
{% paginate %}
{% endif %}
</section>
- <script type="text/javascript" id="disqus">
- var disqus_shortname = 'snipt-net';
- {% if debug %}
- var disqus_developer = 1;
- {% endif %}
-
- (function () {
- var s = document.createElement('script'); s.async = true;
- s.type = 'text/javascript';
- s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
- (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
- }());
- </script>
- <script type="text/html" id="disqus-template">
- var disqus_shortname = 'snipt-net';
- {% if debug %}
- var disqus_developer = 1;
- {% endif %}
-
- (function () {
- var s = document.createElement('script'); s.async = true;
- s.type = 'text/javascript';
- s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
- (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
- }());
- </script>
{% endblock %}
@@ -214,9 +214,6 @@ <h2>{{ snipt.tags.all|length }} tag{{ snipt.tags.all|pluralize }}</h2>
{% else %}
<li class="created" title="{{ snipt.created|date:"Y-m-d\TH:i:s" }}">{{ snipt.created|naturaltime }}</li>
{% endif %}
- {% if snipt.public and not detail %}
- <li class="comments"><a href="{{ snipt.get_full_absolute_url }}#disqus_thread" data-disqus-identifier="{{ snipt.pk }}"></a></li>
- {% endif %}
<li class="raw">
<a href="{{ snipt.get_raw_url }}">Raw</a> /
<a href="{{ snipt.get_raw_url }}?nice">Raw Nice</a>
@@ -106,30 +106,4 @@
</div>
{% endif %}
{% endif %}
- <script type="text/javascript" id="disqus">
- var disqus_shortname = 'snipt-net';
- {% if debug %}
- var disqus_developer = 1;
- {% endif %}
-
- (function () {
- var s = document.createElement('script'); s.async = true;
- s.type = 'text/javascript';
- s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
- (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
- }());
- </script>
- <script type="text/html" id="disqus-template">
- var disqus_shortname = 'snipt-net';
- {% if debug %}
- var disqus_developer = 1;
- {% endif %}
-
- (function () {
- var s = document.createElement('script'); s.async = true;
- s.type = 'text/javascript';
- s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
- (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
- }());
- </script>
{% endblock %}

0 comments on commit b6cf90a

Please sign in to comment.