Skip to content

Commit

Permalink
Added support for drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
JonHMChan committed Apr 7, 2015
1 parent 8cc232c commit fa40d59
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
17 changes: 10 additions & 7 deletions _posts/2015-04-14-redefining-developer-evangelism.markdown
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
layout: post
---
author: jonhmchan
date: 2015-04-14
title: Redefining Developer Evangelism
categories:
- company
- engineering
date: "2015-04-14 00:00:00"
draft: true
categories:
- company
---
layout: post
title: "Redefining Developer Evangelism"
---

# Hello world!
19 changes: 9 additions & 10 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ $(document).ready(function() {
}
$.get("/blog/json/index.json", function(response) {
if (response) {

if (typeof channel !== 'undefined') {
var result = []
for (key in response.posts) {
var post = response.posts[key];
if (post.categories.indexOf(channel) > - 1) {
result.push(post);
var result = [];
for (key in response.posts) {
var post = response.posts[key];
if (post.draft) continue;
if (typeof channel !== 'undefined') {
if (post.categories.indexOf(channel) == - 1) {
continue
}
}
response.posts = result;
result.push(post);
}
response.posts = result;

data = response;

Expand Down Expand Up @@ -76,8 +77,6 @@ $(document).ready(function() {
var post = data.posts[offset + i];
var article = $("article.post:eq(" + i + ")");

console.log(article);

article.css("border-bottom", i == data.posts.length - 1 ? "none" : null);
if (i >= data.posts.length || typeof post == 'undefined') {
article.css("display", "none");
Expand Down
1 change: 1 addition & 0 deletions json/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ layout: null
"categories": [{% for category in post.categories %}"{{ category }}"{% unless forloop.last %},{% endunless %}{% endfor %}],
"date": "{{ post.date | date: "%B %e, %Y" }}",
"author": "{{ post.author }}",
"draft": {% if post.draft %}true{% else %}false{% endif %},
"content": "{{ post.excerpt | strip_html | strip_newlines }}"
{% if forloop.last %}}{% else %}},{% endif %}{% endfor %}
],
Expand Down

0 comments on commit fa40d59

Please sign in to comment.