mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-06-13 10:49:23 +00:00
Fallback to first published date if published date not present
This commit is contained in:
parent
ef582f1bc2
commit
2c968e94cb
|
@ -40,16 +40,13 @@
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% with date=book.published_date|naturalday publisher=book.publishers|join:', ' %}
|
{% if book.published_date or book.first_published_date %}
|
||||||
{% if date or book.first_published_date or book.publishers %}
|
|
||||||
{% if date or book.first_published_date %}
|
|
||||||
<meta
|
<meta
|
||||||
itemprop="datePublished"
|
itemprop="datePublished"
|
||||||
content="{{ book.first_published_date|default:book.published_date|date:'Y-m-d' }}"
|
content="{{ book.first_published_date|default:book.published_date|date:'Y-m-d' }}"
|
||||||
>
|
>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
{% comment %}
|
{% comment %}
|
||||||
@todo The publisher property needs to be an Organization or a Person. We’ll be using Thing which is the more generic ancestor.
|
@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
|
@see https://schema.org/Publisher
|
||||||
|
@ -60,6 +57,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% with date=book.published_date|default:book.first_published_date|naturalday publisher=book.publishers|join:', ' %}
|
||||||
{% if date and publisher %}
|
{% if date and publisher %}
|
||||||
{% blocktrans %}Published {{ date }} by {{ publisher }}.{% endblocktrans %}
|
{% blocktrans %}Published {{ date }} by {{ publisher }}.{% endblocktrans %}
|
||||||
{% elif date %}
|
{% elif date %}
|
||||||
|
@ -67,7 +65,6 @@
|
||||||
{% elif publisher %}
|
{% elif publisher %}
|
||||||
{% blocktrans %}Published by {{ publisher }}.{% endblocktrans %}
|
{% blocktrans %}Published by {{ publisher }}.{% endblocktrans %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
Loading…
Reference in a new issue