Skip to content

Commit

Permalink
Add author and editor lists
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenXenith committed Jan 29, 2024
1 parent efb12da commit 861be9d
Showing 1 changed file with 37 additions and 13 deletions.
50 changes: 37 additions & 13 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,43 @@
<div class="hero-body">
<div class="container">
<h1 class="title">{{ page.title }}</h1>
{% if page.author %}
<p class="subtitle">
By
{% assign author = site.data.authors[page.author] %}
{% if author %}
<a href="{{ author.url }}">
{{ page.author }}
</a>
{% else %}
{{ page.author }}
{% endif %}
</p>
{% endif %}
<p class="subtitle">
{%- if page.authors -%}
Written by
{%- for author in page.authors -%}
{%- assign data = site.data.authors[author] -%}
{%- if data -%}
<a href="{{ data.url }}">
{{author -}}
</a>
{%- else -%}
{{ author -}}
{%- endif -%}

{%- if forloop.last == false -%}
,
{%- endif -%}
{%- endfor -%}
{%- endif -%}

{%- if page.editors -%}
<br>Edited by
{%- for editor in page.editors -%}
{% assign data = site.data.authors[editor] %}
{% if data %}
<a href="{{ data.url }}">
{{editor -}}
</a>
{% else %}
{{ editor -}}
{% endif %}

{%- if forloop.last == false -%}
,
{%- endif -%}
{%- endfor -%}
{%- endif -%}
</p>
<p>
{% for tagname in page.tags %}
{% assign tag = site.my_tags | where: "slug", tagname | first %}
Expand Down

0 comments on commit 861be9d

Please sign in to comment.