Skip to content

Commit

Permalink
Add author, author post and link to indiv author page
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfatbird committed Jun 28, 2020
1 parent 7add236 commit b2b98d0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
16 changes: 16 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,19 @@ plugins:
collections:
authors:
output: true

defaults:
- scope:
path: ""
type: "authors"
values:
layout: "author"
- scope:
path: ""
type: "posts"
values:
layout: "post"
- scope:
path: ""
values:
layout: "default"
15 changes: 15 additions & 0 deletions _layouts/author.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
layout: default
---
<h1>{{ page.name }}</h1>
<h2>{{ page.position }}</h2>

{{ content }}

<h2>Posts</h2>
<ul>
{% assign filtered_posts = site.posts | where: 'author', page.short_name %}
{% for post in filtered_posts %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
8 changes: 8 additions & 0 deletions _layouts/authors.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
layout: default
---

<h1>{{ page.name }}</h1>
<h2>{{ page.position }}</h2>

{{ content }}
8 changes: 7 additions & 1 deletion _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@

<div class="post-content">
<h1>{{ page.title }}</h1>
<p>{{ page.date | date_to_string }} - {{ page.author }}</p>
<p>{{ page.date | date_to_string }}

{% assign author = site.authors | where: 'short_name', page.author | first %}
{% if author %}
- <a href="{{ author.url }}">{{ author.name }}</a>
{% endif %}
</p>

{{ content }}

Expand Down

0 comments on commit b2b98d0

Please sign in to comment.