Skip to content

Commit

Permalink
Fallback to first published date if published date not present
Browse files Browse the repository at this point in the history
  • Loading branch information
dato committed Sep 23, 2023
1 parent ef582f1 commit 2c968e9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions bookwyrm/templates/book/publisher_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,13 @@
</p>
{% endif %}

{% with date=book.published_date|naturalday publisher=book.publishers|join:', ' %}
{% if date or book.first_published_date or book.publishers %}
{% if date or book.first_published_date %}
{% if book.published_date or book.first_published_date %}
<meta
itemprop="datePublished"
content="{{ book.first_published_date|default:book.published_date|date:'Y-m-d' }}"
>
{% endif %}
<p>

{% comment %}
@todo The publisher property needs to be an Organization or a Person. We’ll be using Thing which is the more generic ancestor.
@see https://schema.org/Publisher
Expand All @@ -60,14 +57,14 @@
{% endfor %}
{% endif %}

{% with date=book.published_date|default:book.first_published_date|naturalday publisher=book.publishers|join:', ' %}
{% if date and publisher %}
{% blocktrans %}Published {{ date }} by {{ publisher }}.{% endblocktrans %}
{% elif date %}
{% blocktrans %}Published {{ date }}{% endblocktrans %}
{% elif publisher %}
{% blocktrans %}Published by {{ publisher }}.{% endblocktrans %}
{% endif %}
{% endwith %}
</p>
{% endif %}
{% endwith %}
{% endspaceless %}

0 comments on commit 2c968e9

Please sign in to comment.