Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add option to use Disqus comments #86

Merged
merged 1 commit into from

4 participants

Danny Whalen Dain Miller Brett Nate Wienert
Danny Whalen

Configure with disqus_shortname environment
variable.

Daniel Whalen Add option to use Disqus comments
Configure with disqus_shortname environment
variable
982b8f1
Dain Miller

This is awesome. Thank you for doing this. I am working a Kudos system, but this a great alternative for now.

Brett

@CDainMiller Looking forward to Kudos!

Nate Wienert natew merged commit eda3c87 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 23, 2012
  1. Add option to use Disqus comments

    Daniel Whalen authored
    Configure with disqus_shortname environment
    variable
This page is out of date. Refresh to see the latest.
9 app/assets/stylesheets/posts.css.scss
View
@@ -228,8 +228,13 @@ code {
color: #fff;
}
-.button.space-top {
- margin-top: 100px;
+.button {
+ &.space-top {
+ margin-top: 50px;
+ }
+ &.space-bottom {
+ margin-bottom: 50px;
+ }
}
.left {
16 app/views/posts/_comments.html.erb
View
@@ -0,0 +1,16 @@
+<% if CONFIG['disqus_shortname'].present? %>
+<div id="disqus_thread"></div>
+<script type="text/javascript">
+ /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
+ var disqus_shortname = '<%= CONFIG['disqus_shortname'] %>'; // required: replace example with your forum shortname
+
+ /* * * DON'T EDIT BELOW THIS LINE * * */
+ (function() {
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ dsq.src = 'http://' + 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="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+<% end %>
6 app/views/posts/_post.html.erb
View
@@ -21,7 +21,9 @@
<li><%= link_to 'Edit', '/edit/' + post.id.to_s unless @preview %></li>
</ul>
<%- end -%>
+ <% if @single_post %>
+ <a class="button space-top space-bottom" href="<%= root_url %>">Back to Blog</a>
+ <%= render 'posts/comments' %>
+ <% end %>
</div>
-
- <% if @single_post %><a class="button space-top" href="<%= root_url %>">Back to Blog</a><% end %>
</section>
3  config/config.yml
View
@@ -7,4 +7,5 @@ name: Your name
twitter: your_twitter_handle
github: your_github_handle
email: address@example.com
-google_analytics_id: YOUR_GA_ID
+google_analytics_id: YOUR_GA_ID
+disqus_shortname: <%= ENV.fetch("disqus_shortname") { "" } %>
Something went wrong with that request. Please try again.