Skip to content

Commit

Permalink
Add Disqus
Browse files Browse the repository at this point in the history
  • Loading branch information
tdg5 committed Aug 26, 2015
1 parent 80e8d59 commit 1ab82f6
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 2 deletions.
2 changes: 0 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# TODO
- further post clean up
- post-article share
- add descriptions and other metadata to generated pages
- add rss for generated index pages
- disqus
- css cleanup
- remove need for jquery
- extract SimpleHueman theme
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ redcarpet:
simple_hueman:
rss_item_limit: 10
social:
disqus_shortname: tdg5
facebook_app_id: "1190183924340795"
twitter_username: dannyguinther
tagline: explore, create, adapt, repeat
Expand Down
1 change: 1 addition & 0 deletions _config_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ redcarpet:
simple_hueman:
rss_item_limit: 10
social:
disqus_shortname: tdg5
facebook_app_id: "1190183924340795"
twitter_username: dannyguinther
tagline: explore, create, adapt, repeat
Expand Down
1 change: 1 addition & 0 deletions _data/authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Danny Guinther:
bio: "Hello! I'm a passionate and motivated engineer in the Boston/Cambridge area seeking challenging opportunities to utilize and extend my engineering and development skills through building new libraries, exploring community code, crafting new applications, and enhancing existing products."
slug: tdg5
social:
disqus_shortname: tdg5
github_username: tdg5
facebook_username: danny.guinther
linkedin_username: dannyguinther
Expand Down
28 changes: 28 additions & 0 deletions _includes/widget/disqus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% assign author_data = site.data.authors[page.author] %}
{% if author_data.social.disqus_shortname %}
{% assign disqus_shortname = author_data.social.disqus_shortname %}
{% elsif site.social.disqus_shortname %}
{% assign disqus_shortname = site.social.disqus_shortname %}
{% endif %}
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = "{{ disqus_shortname }}",
disqus_title = "{{ page.title }}",
disqus_url = "{{ page.url | pretty_absolute_url }}";

(function() {
var dsq = document.createElement("script"),
head = document.getElementsByTagName("head")[0];
head = head || document.getElementsByTagName("body")[0];
dsq.async = true;
dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";
dsq.type = "text/javascript";
head.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>
1 change: 1 addition & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ <h1 class="post-title">{{ page.title }}</h1>
<h4 class="heading"><i class="fa fa-hand-o-right"></i>You may also like...</h4>
{% assign related_posts = site.related_posts | slice: 0, 3 %}
{% include widget/related_posts.html %}
{% include widget/disqus.html %}
</div>
</section>
</section>
1 change: 1 addition & 0 deletions _plugins/filters/url_helper_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def archive_url(*); super; end
def author_url(*); super; end
def category_url(*); super; end
def gravatar_avatar_url(*); super; end
def pretty_absolute_url(*); super; end
def pretty_url(*); super; end
def pretty_post_slug_url(*); super; end
def post_image_url(*); super; end
Expand Down
3 changes: 3 additions & 0 deletions _plugins/util/url_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def post_image_url(image_name, page = nil)
File.join("/assets/images/posts/", page_date, image_name)
end

def pretty_absolute_url(url)
absolute_url(pretty_url(url))
end

def pretty_url(url)
return url unless UGLY_URL_MATCHER === url
Expand Down

0 comments on commit 1ab82f6

Please sign in to comment.