Skip to content

Commit 5fd28ec

Browse files
committed
Created macro to render blog posts; updated categories page to use it; style and copy changes.
1 parent 1304f57 commit 5fd28ec

File tree

6 files changed

+9
-25
lines changed

6 files changed

+9
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
_model: blog-categories
22
---
3-
title: Blog Categories: CC Technical Blog (2007-2014)
3+
title: Archive: CC Technical Blog (2007-2014)

models/blog.ini

-2
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,3 @@ order_by = -pub_date, title
2020
[pagination]
2121
enabled = yes
2222
per_page = 10
23-
24-

templates/author.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block title %}{{ this.name }}{% endblock %}
44
{% block header %}Archive: CC Technical Blog (2007-2014){% endblock %}
55
{% block body %}
6-
<h2>Blog Posts by {{ this.name }}</h2>
6+
<h2>Posts by {{ this.name }}</h2>
77
{{ render_blog_list(this.children) }}
88
<hr>
99
<strong><a href="/blog/authors">All Authors</a></strong>

templates/blog-category.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{% extends "layout.html" %}
2-
{% from "macros/categories.html" import render_category_list %}
2+
{% from "macros/posts.html" import render_posts %}
33
{% block title %}{{ this.parent.title }} - {{ this.name }}{% endblock %}
44
{% block header %}{{ this.parent.title }}{% endblock %}
55
{% block body %}
6-
<h1>Category: {{ this.name }}</h1>
7-
{{ render_category_list(this.children) }}
6+
<h2>All posts tagged "{{ this.name }}"</h2>
7+
{{ render_posts(this.children) }}
88
<hr>
99
<strong><a href="{{ this.parent.path }}">All Categories</a></strong>
1010
{% endblock %}

templates/blog.html

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
{% extends "layout.html" %}
22
{% from "macros/pagination.html" import render_pagination %}
3+
{% from "macros/posts.html" import render_posts %}
34
{% block title %}{{ this.title }}{% endblock %}
45
{% block body %}
56
{{ this.description }}
6-
<ul class="blog-index list-unstyled">
7-
{% for post in this.pagination.items %}
8-
<li>
9-
<a href="{{ post|url }}">{{ post.title }}</a>
10-
<p class="text-muted small">by <a href="/blog/authors/{{ post.author }}">{{ post.author }}</a>
11-
on {{ post.pub_date|dateformat("YYYY-MM-dd") }}</p>
12-
</li>
13-
{% endfor %}
14-
</ul>
15-
7+
{{ render_posts(this.pagination.items) }}
168
{% if this.pagination.pages > 1 %}
179
{{ render_pagination(this.pagination) }}
1810
{% endif %}

templates/macros/categories.html

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1+
{% from "macros/posts.html" import render_posts %}
2+
13
{% macro render_categories(categories) %}
24
<ul>
35
{% for category in site.query(categories.path) %}
46
<li><a href="{{ category|url }}">{{ category.name }}</a></li>
57
{% endfor %}
68
</ul>
79
{% endmacro %}
8-
9-
{% macro render_category_list(categories) %}
10-
<ul>
11-
{% for category in categories %}
12-
<li><a href="{{ category|url }}">{{ category.title }}</a></li>
13-
{% endfor %}
14-
</ul>
15-
{% endmacro %}

0 commit comments

Comments
 (0)