Skip to content

Commit c77df3a

Browse files
authored
Merge pull request creativecommons#58 from makkoncept/master
Create author pages that show all of one author's posts.
2 parents 4a95570 + d7e425d commit c77df3a

File tree

43 files changed

+97
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+97
-7
lines changed

content/authors/Matt-Lee/contents.lr

+1

content/authors/akila87/contents.lr

+1

content/authors/akozak/contents.lr

+1

content/authors/alankelon/contents.lr

+1

content/authors/alex/contents.lr

+1

content/authors/ankitg/contents.lr

+1

content/authors/asheesh/contents.lr

+1

content/authors/blaise/contents.lr

+1

content/authors/brian/contents.lr

+1

content/authors/contents.lr

+3

content/authors/cwebber/contents.lr

+1
+1

content/authors/erlehmann/contents.lr

+1

content/authors/frank/contents.lr

+1

content/authors/greg/contents.lr

+1

content/authors/hugo/contents.lr

+1
+1

content/authors/jakin/contents.lr

+1

content/authors/john/contents.lr

+1

content/authors/ksiomelo/contents.lr

+1

content/authors/lunpa/contents.lr

+1

content/authors/mihai/contents.lr

+1

content/authors/ml/contents.lr

+1

content/authors/nathan/contents.lr

+1

content/authors/nimal/contents.lr

+1

content/authors/nkinkade/contents.lr

+1

content/authors/rejon/contents.lr

+1

content/authors/steren/contents.lr

+1

content/authors/tannewt/contents.lr

+1

content/authors/thwang/contents.lr

+1

content/authors/tpkennes/contents.lr

+1

content/tech-blog-archives/getting-started-with-hacking-on-the-list/contents.lr

+1-1

content/tech-blog-archives/how-creativecommons-dot-org-is-built/contents.lr

+1-1

content/tech-blog-archives/weekend-hacks/contents.lr

+1-1

models/author.ini

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[model]
2+
name = Author
3+
label = {{ this.name }}
4+
hidden = yes
5+
6+
[children]
7+
replaced_with = site.query('/tech-blog-archives').filter(F.author.contains(this))
8+
9+
[fields.name]
10+
label = Name
11+
type = string

models/authors.ini

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[model]
2+
name = Authors
3+
label = Authors
4+
hidden = yes
5+
protected = yes
6+
7+
[children]
8+
model = author
9+
order_by = name

models/blog-post.ini

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ width = 1/2
1919

2020
[fields.author]
2121
label = Author
22-
type = string
22+
type = select
23+
source = site.query('/authors')
2324
width = 1/2
2425

2526
[fields.body]

templates/author.html

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "layout.html" %}
2+
{% from "macros/authors.html" import render_blog_list %}
3+
{% block title %}{{ this.name }}{% endblock %}
4+
{% block header %}CC Technical Blog Archives{% endblock %}
5+
{% block body %}
6+
<h2>Blog Posts by {{ this.name }}</h2>
7+
{{ render_blog_list(this.children) }}
8+
<hr>
9+
<strong><a href="/blog/authors">All Authors</a></strong>
10+
{% endblock %}

templates/authors.html

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "layout.html" %}
2+
{% from "macros/authors.html" import render_authors %}
3+
{% block title %}Authors{% endblock %}
4+
{% block header %}CC Technical Blog Archives{% endblock %}
5+
{% block body %}
6+
<h1>Authors</h1>
7+
{{ render_authors() }}
8+
{% endblock %}

templates/blog-post.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
{% block header %}{{ this.parent.title }}{% endblock %}
44
{% block body %}
55
<h2 class="mb-0">{{ this.title }}</h2>
6-
<p class="meta text-muted mt-0">by {{ this.author }} on {{ this.pub_date|dateformat('full') }}</p>
6+
<p class="meta text-muted mt-0">by <a href="/blog/authors/{{ this.author }}">{{ this.author }}</a>
7+
on {{ this.pub_date|dateformat('full') }}</p>
78
<div class="body">{{ this.body }}</div>
89
<hr>
910
<p class="meta mt-0 mb-0"><span class="text-muted">Categories: </span>
@@ -14,4 +15,4 @@ <h2 class="mb-0">{{ this.title }}</h2>
1415
{% else %}
1516
none
1617
{% endif %}</p>
17-
{% endblock %}
18+
{% endblock %}

templates/blog.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
{% for post in this.pagination.items %}
88
<li>
99
<a href="{{ post|url }}">{{ post.title }}</a>
10-
<p class="text-muted small">by {{ post.author }} on {{ post.pub_date|dateformat("YYYY-MM-dd") }}</p>
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>
1112
</li>
1213
{% endfor %}
1314
</ul>

templates/macros/authors.html

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{% macro render_authors() %}
2+
<ul>
3+
{% 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>
13+
{% endfor %}
14+
</ul>
15+
{% endmacro %}

0 commit comments

Comments
 (0)