From 2faba61581bd8a4808475cebc35bfa0a1bf2f6ea Mon Sep 17 00:00:00 2001 From: timurgordon Date: Wed, 27 Jul 2022 16:01:02 +0200 Subject: [PATCH] newsroom refactor to support people taxonomy --- templates/newsPage.html | 26 +++++++++++++++----------- templates/partials/featuredNews.html | 12 +++++++----- templates/partials/newsCard.html | 14 ++++++++------ 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/templates/newsPage.html b/templates/newsPage.html index 7a3afc0af..fb0bc567b 100644 --- a/templates/newsPage.html +++ b/templates/newsPage.html @@ -17,12 +17,14 @@
    - {% for author in page.extra.authors %} - {% set fullpath = "/people/" ~ author | replace(from='_', to='-' ) %} - {% if page.extra.authorImg %} + {% if page.taxonomies.people %} + {% for person in page.taxonomies.people %} + {% 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)) %}
  • - - {{ author }} + {{ author.title }}
  • - {% endif %} {% endfor %} + {% endif %}

- {% for author in page.extra.authors %} - {% set fullpath = "/people/" ~ author | replace(from='_', to='-' ) %} + {% if page.taxonomies.people %} + {% for person in page.taxonomies.people %} + {% set author_path = 'people/' ~ person ~ '/index.md' %} + {% set author = get_page(path=author_path) %} - {{ author | replace(from='_', to=' ' - ) }} + {{ author.title }} - {% endfor %} + {% endfor %} + {% endif %}

{{ featured.date | date(format="%B %e, %Y", timezone="America/Chicago")}} - - {% for author in featured.extra.authors %} - {% set fullpath = "/people/" ~ author | replace(from='_', to='-' ) %} - {{ author | replace(from='_', to=' ' ) }} {{ author.title }} {{author | replace(from='_', to=' ' )}} + " /> {{ author.title }} {% endfor %}

diff --git a/templates/partials/newsCard.html b/templates/partials/newsCard.html index 2efef3895..e519b01d5 100644 --- a/templates/partials/newsCard.html +++ b/templates/partials/newsCard.html @@ -18,12 +18,14 @@
    - {% for author in post.extra.authors %} - {% set fullpath = "/people/" ~ author | replace(from='_', to='-' ) %} - {% if post.extra.authorImg %} + {% if featured.taxonomies.people %} + {% for author in featured.taxonomies.people %} + {% 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)) %}
  • - - {{ author }} + {{ author.title }}
  • - {% endif %} {% endfor %} + {% endif %}