Skip to content

Commit

Permalink
Implement Jekyll Blog Comments
Browse files Browse the repository at this point in the history
Following the instructions in https://github.com/damieng/jekyll-blog-comments
to set up haacked.com to use a jekyll+azure based comment system.
  • Loading branch information
haacked committed Jun 25, 2018
1 parent b5e2830 commit 281b756
Show file tree
Hide file tree
Showing 25 changed files with 493 additions and 84 deletions.
31 changes: 27 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ github_repo_url: https://github.com/Haacked/haacked.com/
# Twitter
twitter_user: haacked

# Disqus Comments
disqus_short_name: haacked
disqus_show_comment_count: true

# Google Analytics
google_analytics_tracking_id: UA-177588-1

Expand Down Expand Up @@ -59,3 +55,30 @@ feed:
sass:
sass_dir: _scss
style: :compressed

emptyArray: []

comments:
receiver: https://haacked-blog.azurewebsites.net/api/PostComment

authors:
haacked:
name: haacked
email: haacked@gmail.com
url: https://haacked.com

defaults:
-
scope:
path: ''
type: pages
values:
layout: page
author: haacked
-
scope:
path: '_posts'
type: posts
values:
layout: post
author: haacked
2 changes: 1 addition & 1 deletion _includes/archive_post.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h3 class="title"><a href="{{ post.url }}">{{post.title}}</a></h3>
{% if post.categories.length > 0 %}
<span class="tags">{% include post/categories.html %}</span>
{% endif %}
{% if site.disqus_short_name and post.comments == true and site.disqus_show_comment_count == true %}
{% if post.comments == true %}
{% include post/comments_link.html %}
{% endif %}
<span class="edit">{% include post/edit.html %}</span>
Expand Down
26 changes: 26 additions & 0 deletions _includes/comment-new.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<form action="/fake" data-action="{{ site.comments.receiver }}" method="post" id="commentform" class="form-horizontal comment-box">
<input name="redirect" type="hidden" value="{{site.url}}/thanks">
<input name="post_id" type="hidden" value="{{ slug }}">
<input name="comment-site" type="hidden" value="{{ site.url }}">
<div id="comment-box">
<img src="/images/comments/unknown-avatar.png" data-fallbacksrc="/images/comments/unknown-avatar.png" data-role="user-avatar" alt="avatar" class="avatar" id="avatarPreview" />
<div id="commenttext">
<div id="commentstatus" class="status"></div>
<div contenteditable="PLAINTEXT-ONLY" tabindex="0" role="textbox" aria-multiline="true" data-role="editable" class="textarea" aria-label="Join the discussion..." id="comment-div"></div>
<input type="hidden" name="message" id="message" data-required="true" value="" />
</div>
</div>
<div id="comment-author">
<div class="control-group">
<input type="hidden" name="avatar" id="avatarInput" />
<input type="text" name="name" id="name" placeholder="Display Name" title="Name displayed with your comment" data-required="true" />
<input type="text" name="identity" id="identity" placeholder="email/@twitter/github" data-required="true" value="" />
<span class="info-circle" title="Identity is used to generate an avatar image only. It is not submitted with the form."></span>
<button type="button" id="commentbutton">Leave response</button>
<div id="remember-me">
<input type="checkbox" name="remember" id="remember"><label for="remember">Remember me</label>
<span class="info-circle" title="Stores your name and email in the browser so you don't have to fill out the form again. This does not set a cookie."></span>
</div>
</div>
</div>
</form>
32 changes: 32 additions & 0 deletions _includes/comment.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% if comment.url %}
<a href="{{ comment.url }}" rel="nofollow">
<img alt="Avatar for {{ comment.name | xml_escape }}" src="{{comment.avatar}}" class="avatar" height="48" width="48">
</a>
{% else %}
<img alt="Avatar for {{ comment.name | xml_escape }}" src="{{comment.avatar}}" class="avatar" height="48" width="48">
{% endif %}

<blockquote id="{{ comment.id }}">
<cite>
<span class="author">
{% if comment.url %}
<a href="{{ comment.url }}" rel="nofollow">{{ comment.name | xml_escape }}</a>
{% else %}
{{ comment.name | xml_escape }}
{% endif %}
</span>
<span class="bullet"></span>
<a href="#{{ comment.id }}" class="muted" title="{{ comment.date | date_to_rfc822 }}">
{{ comment.date | date: '%B' }}
{% assign d = comment.date | date: "%-d" %}
{% case d %}
{% when '1' or '21' or '31' %}{{d}}st,
{% when '2' or '22' %}{{d}}nd,
{% when '3' or '23' %}{{d}}rd,
{% else %}{{d}}th,
{% endcase %}
{{ comment.date | date: '%Y' }}
</a>
</cite>
<div class="comment-body">{{ comment.message | markdownify }}</div>
</blockquote>
22 changes: 22 additions & 0 deletions _includes/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% capture default_slug %}{{ page.slug | default: (page.title | slugify) }}{% endcapture %}
{% capture slug %}{{ (page.slug | fallback: default_slug) | downcase | replace: '.', '-' }}{% endcapture %}
{% assign comments_map = site.data.comments[slug] %}
{% assign comments = site.emptyArray %}
{% for comment in comments_map %}
{% assign comments = comments | push: comment[1] %}
{% endfor %}
{% assign comment_count = comments | size %}
{% assign author = site.authors[page.author] %}
<div id="comments">
<h2>Comments</h2>
{% include comment-new.html %}
<h3 id="comment-count">{% if comment_count == 1 %}One response{% else %}{{ comment_count }} responses{% endif %}</h3>
<ol id="comments-list">
{% assign sorted_comments = comments | sort: 'date' %}
{% for comment in sorted_comments %}
<li{% if comment.name == author.name %} class="byauthor" {% endif %}>
{% include comment.html %}
</li>
{% endfor %}
</ol>
</div>
27 changes: 0 additions & 27 deletions _includes/disqus.html

This file was deleted.

2 changes: 0 additions & 2 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
| <a href="/privacy">privacy</a>
| <a href="/articles/blogtegrity">blogtegrity</a>
</p>

{% include disqus.html %}
7 changes: 5 additions & 2 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
<link href="/favicon.ico" rel="shortcut icon">
<link rel="stylesheet" href="/css/styles.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="/js/utils.js"></script>
<script src="/js/slash.js" async></script>
{% seo %}
{% include google_analytics.html %}
<script src="/js/md5.min.js" async></script>
<script src="/js/comment-box.js" async></script>
{% seo %}
{% include google_analytics.html %}
</head>
8 changes: 1 addition & 7 deletions _includes/post/comments_link.html
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
{% if post.disqus_identifier %}
{% assign disqus_identifier = post.disqus_identifier %}
{% else %}
{% assign disqus_identifier = page.disqus_identifier %}
{% endif %}

<span class="comments"><a href="{{ post.url }}#disqus_thread"{% if disqus_identifier %} data-disqus-identifier="{{ disqus_identifier }}"{% endif %}>comments</a></span>
<span class="comments"><a href="{{ post.url }}#comments">comments</a></span>
1 change: 0 additions & 1 deletion _includes/post/disqus_thread.html

This file was deleted.

6 changes: 3 additions & 3 deletions _includes/post/meta.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="meta">
<span class="date">{% include post/date.html %}{{ time }}</span>
<span class="tags">{% include post/categories.html %}</span>
{% if site.disqus_short_name and site.disqus_show_comment_count == true %}
{% include post/comments_link.html %}
{% if post.comments != false %}
{% include post/comments_link.html %}
{% endif %}
<span class="edit">{% include post/edit.html %}</span>
</div>
</div>
8 changes: 3 additions & 5 deletions _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ <h1 class="title">{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{
{% endif %}
<div class="entry-content">{{ content }}</div>
</article>
{% if site.disqus_short_name and page.comments == true %}
<section id="comment">
<h1 class="title">Comments</h1>
<div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div>
</section>

{% if page.comments == true %}
{% include comments.html %}
{% endif %}
7 changes: 1 addition & 6 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,4 @@
</div>
</div>

{% if site.disqus_short_name and page.comments == true %}
<section id="comment">
<h1 class="title">Comments</h1>
<div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div>
</section>
{% endif %}
{% include comments.html %}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ title: Connecting to Terminal Services When All Active Sessions are Used
date: 2005-10-13 -0800
comments: true
disqus_identifier: 10783
categories: []
categories: [remote-desktop terminal-services]
redirect_from:
/archive/2005/10/12/remote_desktop_to_console_session.aspx/
/archive/2005/10/15/remote_desktop_to_console_session.aspx/
- "/archive/2005/10/12/remote_desktop_to_console_session.aspx/"
- "/archive/2005/10/15/remote_desktop_to_console_session.aspx/"
---

UPDATE: If you are using Windows Server 2008, the switch is **`/admin`** not `/console`. See this post [for details](http://blogs.msdn.com/ts/archive/2007/12/17/changes-to-remote-administration-in-windows-server-2008.aspx "details").
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Mapping Drives Via Remote Desktop
date: 2006-10-22 -0800
comments: true
disqus_identifier: 18101
categories: []
categories: [remote-desktop]
redirect_from: "/archive/2006/10/21/Mapping_Drives_Via_Remote_Desktop.aspx/"
---

Expand All @@ -21,5 +21,3 @@ This is a handy tip to go with these others:
Port](https://haacked.com/archive/2006/10/17/Remote_Desktop_On_A_NonStandard_Port.aspx "Using alternate ports")
- [Connecting To Remote Server When Active Sessions Are
Used](https://haacked.com/archive/2005/10/13/Remote_Desktop_To_Console_Session.aspx "How to remote into the console")


0 comments on commit 281b756

Please sign in to comment.