From d9e379d1e7d3e3f802d74bb15ded562ab13354e3 Mon Sep 17 00:00:00 2001 From: davidtsadler Date: Sat, 14 Jan 2012 19:25:54 +0000 Subject: Add categories for posts. --- _config.yml.example | 12 ++++++ _site_build/_includes/post_excerpt.html | 3 ++ _site_build/_layouts/category_index.html | 10 +++++ _site_build/_layouts/post.html | 3 ++ _site_build/_plugins/category_indexes.rb | 63 ++++++++++++++++++++++++++++++++ _site_build/css/style.css | 30 ++++++--------- _site_build/index.html | 2 +- templates/post.markdown | 1 + 8 files changed, 105 insertions(+), 19 deletions(-) create mode 100644 _site_build/_layouts/category_index.html create mode 100644 _site_build/_plugins/category_indexes.rb diff --git a/_config.yml.example b/_config.yml.example index 248c858..e46d2bc 100644 --- a/_config.yml.example +++ b/_config.yml.example @@ -68,3 +68,15 @@ permalink: /archives/:year/:month/:day/:title/ # Directory where plugins are located. plugins: _site_build/_plugins + +# Set to true to have Jekyll generate category pages for posts. +#generate_category_indexes: true + +# The directory where categories will be served from. Defaults to categories +#category_dir: + +# String prefixed to the title of the category page. Defaults to Category: +#category_title_prefix: + +# String prefixed to the meta description of the category page. Defaults to Category: +#category_meta_description_prefix: diff --git a/_site_build/_includes/post_excerpt.html b/_site_build/_includes/post_excerpt.html index 461cb55..48e4a1e 100644 --- a/_site_build/_includes/post_excerpt.html +++ b/_site_build/_includes/post_excerpt.html @@ -2,6 +2,9 @@

{{ post.title }}

+ {% if post.categories.size != 0 %} +
Posted in {{ post.categories | category_links }}
+ {% endif %}
{{ post.content | truncate }} diff --git a/_site_build/_layouts/category_index.html b/_site_build/_layouts/category_index.html new file mode 100644 index 0000000..729ff2e --- /dev/null +++ b/_site_build/_layouts/category_index.html @@ -0,0 +1,10 @@ +--- +layout: default +robots: follow, noindex, noodp, noydir, noarchive +--- +
+

{{ page.title }}

+ {% for post in site.categories[page.category] %} + {% include post_excerpt.html %} + {% endfor %} +
diff --git a/_site_build/_layouts/post.html b/_site_build/_layouts/post.html index e45ca24..61f0d09 100644 --- a/_site_build/_layouts/post.html +++ b/_site_build/_layouts/post.html @@ -5,6 +5,9 @@ layout: default

{{ page.title }}

+ {% if page.categories.size != 0 %} +
Posted in {{ page.categories | category_links }}
+ {% endif %}
{{ content }}