add author taxonomy support to blog page & card

This commit is contained in:
timurgordon
2022-07-24 21:29:51 +02:00
parent d06d3259cf
commit 58c6cd32f8
2 changed files with 25 additions and 5 deletions

View File

@@ -1,6 +1,11 @@
{% extends "_default/base.html" %}
{% block content %}
{% if page.taxonomies.people %}
{% set author_path = 'people/' ~ page.taxonomies.people[0] ~ '/index.md' %}
{% set author = get_page(path=author_path) %}
{% endif %}
<!-- Default page template for blog posts and basic informative markdown files -->
<main>
@@ -19,7 +24,9 @@
<div class="flex justify-between items-center">
<ul class="list-none flex author-list m-0">
<li class="author-list-item">
<img src="/{{page.extra.authorImg}}" alt="{{page.extra.author}}" class="
{% if author %}
{% set author_img = get_url(path='/' ~ author.relative_path | replace(from='_', to='-') | replace(from='index.md', to=author.extra.imgPath)) %}
<img src="{{author_img}}" alt="{{author.title}}" class="
h-8
w-8
sm:h-10
@@ -29,11 +36,14 @@
border-2 border-white
" />
</li>
{% endif %}
</ul>
</div>
<div class="pl-3 flex flex-col text-xs leading-none uppercase">
<p class="text-gray-700 text-xs">{{ page.extra.author }}</p>
{% if author %}
<p class="text-gray-700 text-xs">{{ author.title }}</p>
{% endif %}
<p class="text-gray-700 text-xs">
<time datetime="{{ page.date }}"> {{ page.date | date(format="%B %e, %Y", timezone="America/Chicago") }}</time>
</p>

View File

@@ -1,3 +1,8 @@
{% if post.taxonomies.people %}
{% set author_path = 'people/' ~ post.taxonomies.people[0] ~ '/index.md' %}
{% set author = get_page(path=author_path) %}
{% endif %}
<div class="flex flex-col rounded-lg shadow-lg overflow-hidden">
<div class="flex-1 border-b">
<a href="{{ post.permalink }}" class="block">
@@ -21,12 +26,17 @@
<div class="flex items-center">
<div class="flex justify-between items-center">
<ul class="list-none flex author-list mr-2">
<li class="author-list-item"><img alt="{{post.extra.author}}" src="{{post.extra.authorImg}}"
{% if author %}
{% set author_img = get_url(path='/' ~ author.relative_path | replace(from='_', to='-') | replace(from='index.md', to=author.extra.imgPath)) %}
<li class="author-list-item"><img alt="{{author.title}}" src="{{author_img}}"
class="w-8 h-8 rounded-full bg-gray-200 border-2 border-white"></li>
{% endif %}
</ul>
</div>
<div class="flex flex-col text-left leading-none uppercase">
<p class="text-gray-700 text-xs">{{ post.extra.author }}</p>
{% if author %}
<p class="text-gray-700 text-xs">{{ author.title }}</p>
{% endif %}
<p class="text-gray-700 text-xs">
<time datetime="{{post.date}}">
{{ post.date | date(format="%B %e, %Y", timezone="America/Chicago") }}