newsroom refactor to support people taxonomy

This commit is contained in:
timurgordon
2022-07-27 16:01:02 +02:00
parent 22b411e7c2
commit 2faba61581
3 changed files with 30 additions and 22 deletions

View File

@@ -17,12 +17,14 @@
<div class="flex items-center"> <div class="flex items-center">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<ul class="list-none flex author-list my-10 mr-2 px-0"> <ul class="list-none flex author-list my-10 mr-2 px-0">
{% for author in page.extra.authors %} {% if page.taxonomies.people %}
{% set fullpath = "/people/" ~ author | replace(from='_', to='-' ) %} {% for person in page.taxonomies.people %}
{% if page.extra.authorImg %} {% set author_path = 'people/' ~ person ~ '/index.md' %}
{% set author = get_page(path=author_path) %}
{% 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"> <li class="author-list-item">
<a href="{{fullpath}}" tooltip="{{author}}"> <a href="{{author.permalink}}" tooltip="{{author.title}}">
<img src="/{{ page.extra.authorImg }}" alt="{{ author }}" class=" <img src="{{author_img}}" alt="{{ author.title }}" class="
w-10 w-10
h-10 h-10
rounded-full rounded-full
@@ -31,20 +33,22 @@
" /> " />
</a> </a>
</li> </li>
{% endif %}
{% endfor %} {% endfor %}
{% endif %}
</ul> </ul>
</div> </div>
<div class="pl-3 flex flex-col text-xs leading-none uppercase"> <div class="pl-3 flex flex-col text-xs leading-none uppercase">
<p> <p>
{% for author in page.extra.authors %} {% if page.taxonomies.people %}
{% set fullpath = "/people/" ~ author | replace(from='_', to='-' ) %} {% for person in page.taxonomies.people %}
{% set author_path = 'people/' ~ person ~ '/index.md' %}
{% set author = get_page(path=author_path) %}
<span> <span>
<a href="{{fullpath}}" tooltip="{{author}}" class="hover:underline text-gray-800">{{ author | replace(from='_', to=' ' <a href="{{author.permalink}}" tooltip="{{author.title}}" class="hover:underline text-gray-800">{{ author.title }}</a>
) }}</a>
</span> </span>
{% endfor %} {% endfor %}
{% endif %}
</p> </p>
<p class="text-gray-700"> <p class="text-gray-700">
<time datetime="{{page.date}}"> <time datetime="{{page.date}}">

View File

@@ -12,17 +12,19 @@
<h4 class="text-sm not-italic font-light leading-6 text-gray-600"> <h4 class="text-sm not-italic font-light leading-6 text-gray-600">
{{ featured.date | date(format="%B %e, %Y", timezone="America/Chicago")}} - {{ featured.date | date(format="%B %e, %Y", timezone="America/Chicago")}} -
{% for author in featured.extra.authors %} {% for author in featured.taxonomies.people %}
{% set fullpath = "/people/" ~ author | replace(from='_', to='-' ) %} {% set author_path = 'people/' ~ author ~ '/index.md' %}
<a href="{{fullpath}}" tooltip="{{author}}" class="capitalize text-gray-800"> <img {% set author = get_page(path=author_path) %}
src="{{ featured.extra.authorImg }}" alt="{{ author | replace(from='_', to=' ' ) }}" class=" {% set author_img = get_url(path='/' ~ author.relative_path | replace(from='_', to='-') | replace(from='index.md', to=author.extra.imgPath)) %}
<a href="{{author.permalink}}" tooltip="{{author.title}}" class="capitalize text-gray-800"> <img
src="{{ author_img }}" alt="{{ author.title }}" class="
inline-flex inline-flex
w-8 w-8
h-8 h-8
rounded-full rounded-full
bg-gray-200 bg-gray-200
border-2 border-white border-2 border-white
" /> {{author | replace(from='_', to=' ' )}}</a> " /> {{ author.title }}</a>
{% endfor %} {% endfor %}
</h4> </h4>

View File

@@ -18,12 +18,14 @@
<div class="flex items-center"> <div class="flex items-center">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<ul class="list-none flex author-list my-10 mr-2 px-0"> <ul class="list-none flex author-list my-10 mr-2 px-0">
{% for author in post.extra.authors %} {% if featured.taxonomies.people %}
{% set fullpath = "/people/" ~ author | replace(from='_', to='-' ) %} {% for author in featured.taxonomies.people %}
{% if post.extra.authorImg %} {% set author_path = 'people/' ~ author ~ '/index.md' %}
{% set author = get_page(path=author_path) %}
{% 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"> <li class="author-list-item">
<a href="{{fullpath}}" tooltip="{{author}}"> <a href="{{ author.permalink }}" tooltip="{{ author.title }}">
<img src="{{ post.extra.authorImg }}" alt="{{ author }}" class=" <img src="{{ author_img }}" alt="{{ author.title }}" class="
w-8 w-8
h-8 h-8
rounded-full rounded-full
@@ -32,8 +34,8 @@
" /> " />
</a> </a>
</li> </li>
{% endif %}
{% endfor %} {% endfor %}
{% endif %}
</ul> </ul>
</div> </div>