From 2c968e94cbf7452437303789746b3fa8f40a87d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adeodato=20Sim=C3=B3?=
Date: Mon, 18 Sep 2023 21:19:14 -0300
Subject: [PATCH 1/2] Fallback to first published date if published date not
present
---
bookwyrm/templates/book/publisher_info.html | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/bookwyrm/templates/book/publisher_info.html b/bookwyrm/templates/book/publisher_info.html
index b39bcf5ce..41e7e26f2 100644
--- a/bookwyrm/templates/book/publisher_info.html
+++ b/bookwyrm/templates/book/publisher_info.html
@@ -40,16 +40,13 @@
{% 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 %}
{% endif %}
-
{% 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
@@ -60,6 +57,7 @@
{% 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 %}
@@ -67,7 +65,6 @@
{% elif publisher %}
{% blocktrans %}Published by {{ publisher }}.{% endblocktrans %}
{% endif %}
+ {% endwith %}
-{% endif %}
-{% endwith %}
{% endspaceless %}
From ec2c5cb54600ae24105f434e3097f3780180e671 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adeodato=20Sim=C3=B3?=
Date: Sat, 23 Sep 2023 18:23:15 -0300
Subject: [PATCH 2/2] Only use first publish date if publisher is unknown
---
bookwyrm/templates/book/publisher_info.html | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bookwyrm/templates/book/publisher_info.html b/bookwyrm/templates/book/publisher_info.html
index 41e7e26f2..e3ffedca8 100644
--- a/bookwyrm/templates/book/publisher_info.html
+++ b/bookwyrm/templates/book/publisher_info.html
@@ -58,12 +58,12 @@
{% endif %}
{% with date=book.published_date|default:book.first_published_date|naturalday publisher=book.publishers|join:', ' %}
- {% if date and publisher %}
+ {% if book.published_date and publisher %}
{% blocktrans %}Published {{ date }} by {{ publisher }}.{% endblocktrans %}
- {% elif date %}
- {% blocktrans %}Published {{ date }}{% endblocktrans %}
{% elif publisher %}
{% blocktrans %}Published by {{ publisher }}.{% endblocktrans %}
+ {% elif date %}
+ {% blocktrans %}Published {{ date }}{% endblocktrans %}
{% endif %}
{% endwith %}