Skip to content

Commit a632954

Browse files
committed
Fixed authors' posts not showing up correctly.
1 parent 17cf400 commit a632954

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

models/author.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ label = {{ this.name }}
44
hidden = yes
55

66
[children]
7-
replaced_with = site.query('/archives/old-tech-blog').filter(F.author.contains(this))
7+
replaced_with = site.query('/archives/old-tech-blog/entries').filter(F.author.contains(this))
88

99
[fields.name]
1010
label = Name

templates/author.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{% extends "layout.html" %}
2-
{% from "macros/authors.html" import render_blog_list %}
2+
{% from "macros/posts.html" import render_posts %}
33
{% block title %}{{ this.name }}{% endblock %}
44
{% block header %}Archive: CC Technical Blog (2007-2014){% endblock %}
55
{% block body %}
66
<h2>Posts by {{ this.name }}</h2>
7-
{{ render_blog_list(this.children) }}
7+
{{ render_posts(this.children) }}
88
<hr>
99
<strong><a href="/blog/authors">All Authors</a></strong>
1010
{% endblock %}

templates/authors.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
{% block title %}Authors{% endblock %}
44
{% block header %}Archive: CC Technical Blog (2007-2014){% endblock %}
55
{% block body %}
6-
<h1>Authors</h1>
6+
<h2>Authors</h2>
77
{{ render_authors() }}
88
{% endblock %}

templates/macros/authors.html

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
{% macro render_authors() %}
2-
<ul>
2+
<ul class="list-inline">
33
{% for author in site.query('/authors') %}
4-
<li><a href="{{ author|url }}">{{ author.name }}</a></li>
5-
{% endfor %}
6-
</ul>
7-
{% endmacro %}
8-
9-
{% macro render_blog_list(blogs) %}
10-
<ul>
11-
{% for blog in blogs %}
12-
<li><a href="{{ blog|url }}">{{ blog.title }}</a></li>
4+
<li class="list-inline-item"><a href="{{ author|url }}">{{ author.name }}</a></li>
135
{% endfor %}
146
</ul>
157
{% endmacro %}

templates/macros/posts.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% macro render_posts(posts) %}
2+
<ul class="blog-index list-unstyled">
3+
{% for post in posts %}
4+
<li>
5+
<a href="{{ post|url }}">{{ post.title }}</a>
6+
<p class="text-muted small">by <a href="/blog/authors/{{ post.author }}">{{ post.author }}</a>
7+
on {{ post.pub_date|dateformat("YYYY-MM-dd") }}</p>
8+
</li>
9+
{% endfor %}
10+
</ul>
11+
{% endmacro %}

0 commit comments

Comments
 (0)