Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
codinfox committed Mar 6, 2015
1 parent 1656053 commit d4d7c4a
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 72 deletions.
1 change: 1 addition & 0 deletions _posts/2013-12-31-whats-jekyll.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ layout: post
title: What's Jekyll?
comments: true
category: Misc
tags: jekyll
---

[Jekyll](http://jekyllrb.com) is a static site generator, an open-source tool for creating simple yet powerful websites of all shapes and sizes. From [the project's readme](https://github.com/mojombo/jekyll/blob/master/README.markdown):
Expand Down
85 changes: 85 additions & 0 deletions blog/category.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
layout: blog_index
title: Category
---
{% comment%}
Here we generate all the categories.
{% endcomment%}

{% assign rawcats = "" %}
{% for post in site.posts %}
{% assign tcats = post.category | join:'|' | append:'|' %}
{% assign rawcats = rawcats | append:tcats %}
{% endfor %}

{% assign rawcats = rawcats | split:'|' | sort %}

{% assign cats = "" %}

{% for cat in rawcats %}
{% if cat != "" %}

{% if cats == "" %}
{% assign cats = cat | split:'|' %}
{% endif %}

{% unless cats contains cat %}
{% assign cats = cats | join:'|' | append:'|' | append:cat | split:'|' %}
{% endunless %}
{% endif %}
{% endfor %}

<h1 class="page-title">
<a href="/blog">Blog</a> | {{ page.title }}
</h1>
<br/>

<div class="posts">
<p>
{% for ct in cats %}
<a href="#{{ ct | slugify }}" class="codinfox-category-mark" style="color:#999;text-decoration: none;"> {{ ct }} </a> &nbsp;&nbsp;
{% endfor %}
<a href="#no-category" class="codinfox-category-mark" style="color:#999;text-decoration: none;"> No Category </a> &nbsp;&nbsp;
</p>

{% for ct in cats %}
<h2 id="{{ ct | slugify }}">{{ ct }}</h2>
<ul class="codinfox-category-list">
{% for post in site.posts %}
{% if post.category contains ct %}
<li>
<h3>
<a href="{{ post.url }}">
{{ post.title }}
<small>{{ post.date | date_to_string }}</small>
</a>
{% for tag in post.tags %}
<a class="codinfox-tag-mark" href="/blog/tag/#{{ tag | slugify }}">{{ tag }}</a>
{% endfor %}
</h3>
</li>
{% endif %}
{% endfor %}
</ul>
{% endfor %}

<h2 id="no-category">No Category</h2>
<ul class="codinfox-category-list">
{% for post in site.posts %}
{% unless post.category %}
<li>
<h3>
<a href="{{ post.url }}">
{{ post.title }}
<small>{{ post.date | date_to_string }}</small>
</a>
{% for tag in post.tags %}
<a class="codinfox-tag-mark" href="/blog/tag/#{{ tag | slugify }}">{{ tag }}</a>
{% endfor %}
</h3>
</li>
{% endunless %}
{% endfor %}
</ul>

</div>
39 changes: 0 additions & 39 deletions blog/category_index.html

This file was deleted.

76 changes: 43 additions & 33 deletions blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,58 @@
title: Blog
---

<h1 class="page-title">
{{ page.title }} | <a href="/blog/category_index">Category</a>
</h1>
<br/>
<h1 class="page-title" style="display:inline-block;"> {{ page.title }} </h1>

<div style="display:inline-block;margin-left:.5em;">
Browse by <a href="/blog/category/">Category</a> or <a href="/blog/tag/">Tag</a>
</div>

<br/><br/>

<div class="posts">
{% for post in paginator.posts %}
<div class="post">
<h1 class="post-title">
<a href="{{ post.url }}">
{{ post.title }}
</a>
</h1>

<span class="post-date">{{ post.date | date_to_string }} | <a href="{{ post.url }}#disqus_thread">0 Comments</a>
</span>

{% if post.content contains "<!-- more -->" %}
{{ post.content | split:"<!-- more -->" | first % }}
{% else %}
{{ post.content | truncatewords:35 }}
{% endif %}
<!-- <a href="{{ post.url }}" style="display:block;">[Read more]</a>
-->

</div>
{% endfor %}
{% for post in paginator.posts %}
<div class="post">
<h1 class="post-title">
<a href="{{ post.url }}">
{{ post.title }}
</a>
</h1>

<span class="post-date">
{{ post.date | date_to_string }}
{% if post.tags != empty %}
|
{% for tag in post.tags %}
<a class="codinfox-tag-mark" href="/blog/tag/#{{ tag | slugify }}">{{ tag }}</a>
{% endfor %}
{% endif %}
</span>

{{ post.content | split:"<!-- more -->" | first % }}

<div class="codinfox-post-more">
<a href="{{ post.url }}#disqus_thread">Comment</a>&nbsp;
<a href="{{ post.url }}">Read more</a>
</div>
<hr/>

</div>
{% endfor %}
</div>

<div class="pagination">
{% if paginator.next_page %}
{% if paginator.next_page %}
<a class="pagination-item older" href="/blog/page{{paginator.next_page}}">Older</a>
{% else %}
{% else %}
<span class="pagination-item older">Older</span>
{% endif %}
{% if paginator.previous_page %}
{% endif %}
{% if paginator.previous_page %}
{% if paginator.page == 2 %}
<a class="pagination-item newer" href="/blog">Newer</a>
<a class="pagination-item newer" href="/blog">Newer</a>
{% else %}
<a class="pagination-item newer" href="/blog/page{{paginator.previous_page}}">Newer</a>
<a class="pagination-item newer" href="/blog/page{{paginator.previous_page}}">Newer</a>
{% endif %}
{% else %}
{% else %}
<span class="pagination-item newer">Newer</span>
{% endif %}
{% endif %}
</div>
64 changes: 64 additions & 0 deletions blog/tag.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
layout: blog_index
title: Tag
---
{% comment%}
Here we generate all the tags.
{% endcomment%}

{% assign rawtags = "" %}
{% for post in site.posts %}
{% assign ttags = post.tags | join:'|' | append:'|' %}
{% assign rawtags = rawtags | append:ttags %}
{% endfor %}

{% assign rawtags = rawtags | split:'|' | sort %}

{% assign tags = "" %}

{% for tag in rawtags %}
{% if tag != "" %}

{% if tags == "" %}
{% assign tags = tag | split:'|' %}
{% endif %}

{% unless tags contains tag %}
{% assign tags = tags | join:'|' | append:'|' | append:tag | split:'|' %}
{% endunless %}
{% endif %}
{% endfor %}

<h1 class="page-title">
<a href="/blog">Blog</a> | {{ page.title }}
</h1>
<br/>

<div class="posts">
<p>
{% for tag in tags %}
<a href="#{{ tag | slugify }}" class="codinfox-tag-mark"> {{ tag }} </a> &nbsp;&nbsp;
{% endfor %}

{% for tag in tags %}
<h2 id="{{ tag | slugify }}">{{ tag }}</h2>
<ul class="codinfox-category-list">
{% for post in site.posts %}
{% if post.tags contains tag %}
<li>
<h3>
<a href="{{ post.url }}">
{{ post.title }}
<small>{{ post.date | date_to_string }}</small>
</a>
{% for tag in post.tags %}
<a class="codinfox-tag-mark" href="/blog/tag/#{{ tag | slugify }}">{{ tag }}</a>
{% endfor %}
</h3>
</li>
{% endif %}
{% endfor %}
</ul>
{% endfor %}

</div>

0 comments on commit d4d7c4a

Please sign in to comment.