mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 02:51:13 +00:00
Minor vocabulary fixes and structured data improvements (#3036)
* Remove duplicate Review object under `rating` property This was preventing validation, since `rating` is not a valid property (`review` is, which is created from book.html already). * Drop `bestRating` property in ratings, since it defaults to 5 See <https://schema.org/bestRating> ("If bestRating is omitted, 5 is assumed"). * Create Rating object (and its enclosing Review) in book/rating.html * Use `position` property for Book objects in a series `volumeNumber`, previously used, is only valid for objects of type PublicationVolume (which series members are not). * Give URL of book series when setting of `isPartOf` * series.html: Add empty BookSeries object --------- Co-authored-by: Adeodato Simó <dato@users.noreply.github.com>
This commit is contained in:
parent
695c67a714
commit
698e74a496
5 changed files with 22 additions and 31 deletions
|
@ -44,16 +44,18 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if book.series %}
|
{% if book.series %}
|
||||||
<meta itemprop="isPartOf" content="{{ book.series | escape }}">
|
<meta itemprop="position" content="{{ book.series_number }}">
|
||||||
<meta itemprop="volumeNumber" content="{{ book.series_number }}">
|
<span itemprop="isPartOf" itemscope itemtype="https://schema.org/BookSeries">
|
||||||
|
|
||||||
{% if book.authors.exists %}
|
{% if book.authors.exists %}
|
||||||
<a href="{% url 'book-series-by' book.authors.first.id %}?series_name={{ book.series | urlencode }}">
|
<a href="{% url 'book-series-by' book.authors.first.id %}?series_name={{ book.series | urlencode }}"
|
||||||
|
itemprop="url">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ book.series }}{% if book.series_number %} #{{ book.series_number }}{% endif %}
|
<span itemprop="name">{{ book.series }}</span>
|
||||||
|
{% if book.series_number %} #{{ book.series_number }}{% endif %}
|
||||||
{% if book.authors.exists %}
|
{% if book.authors.exists %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -186,8 +188,6 @@
|
||||||
itemtype="https://schema.org/AggregateRating"
|
itemtype="https://schema.org/AggregateRating"
|
||||||
>
|
>
|
||||||
<meta itemprop="ratingValue" content="{{ rating|floatformat }}">
|
<meta itemprop="ratingValue" content="{{ rating|floatformat }}">
|
||||||
{# @todo Is it possible to not hard-code the value? #}
|
|
||||||
<meta itemprop="bestRating" content="5">
|
|
||||||
<meta itemprop="reviewCount" content="{{ review_count }}">
|
<meta itemprop="reviewCount" content="{{ review_count }}">
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
|
|
|
@ -5,13 +5,18 @@
|
||||||
{% include 'snippets/avatar.html' with user=user %}
|
{% include 'snippets/avatar.html' with user=user %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="media-content">
|
<div class="media-content" itemprop="review" itemscope itemtype="https://schema.org/Review">
|
||||||
<div>
|
<div itemprop="author"
|
||||||
<a href="{{ user.local_path }}">{{ user.display_name }}</a>
|
itemscope
|
||||||
|
itemtype="https://schema.org/Person"
|
||||||
|
>
|
||||||
|
<a href="{{ user.local_path }}" itemprop="url">
|
||||||
|
<span itemprop="name">{{ user.display_name }}</span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="is-flex">
|
<div class="is-flex" itemprop="reviewRating" itemscope itemtype="https://schema.org/Rating">
|
||||||
|
<meta itemprop="ratingValue" content="{{ rating.rating|floatformat }}">
|
||||||
<p class="mr-1">{% trans "rated it" %}</p>
|
<p class="mr-1">{% trans "rated it" %}</p>
|
||||||
|
|
||||||
{% include 'snippets/stars.html' with rating=rating.rating %}
|
{% include 'snippets/stars.html' with rating=rating.rating %}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
{% block title %}{{ series_name }}{% endblock %}
|
{% block title %}{{ series_name }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="block">
|
<div class="block" itemscope itemtype="https://schema.org/BookSeries">
|
||||||
<h1 class="title">{{ series_name }}</h1>
|
<h1 class="title" itemprop="name">{{ series_name }}</h1>
|
||||||
<div class="subtitle" dir="auto">
|
<div class="subtitle" dir="auto">
|
||||||
{% trans "Series by" %} <a
|
{% trans "Series by" %} <a
|
||||||
href="{{ author.local_path }}"
|
href="{{ author.local_path }}"
|
||||||
class="author {{ link_class }}"
|
class="author {{ link_class }}"
|
||||||
itemprop="author"
|
itemprop="creator"
|
||||||
itemscope
|
itemscope
|
||||||
itemtype="https://schema.org/Thing"
|
itemtype="https://schema.org/Person"
|
||||||
><span
|
><span
|
||||||
itemprop="name"
|
itemprop="name"
|
||||||
>{{ author.name }}</span></a>
|
>{{ author.name }}</span></a>
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
<div class="columns is-multiline is-mobile">
|
<div class="columns is-multiline is-mobile">
|
||||||
{% for book in books %}
|
{% for book in books %}
|
||||||
{% with book=book %}
|
{% with book=book %}
|
||||||
|
{# @todo Set `hasPart` property in some meaningful way #}
|
||||||
<div class="column is-one-fifth-tablet is-half-mobile is-flex is-flex-direction-column">
|
<div class="column is-one-fifth-tablet is-half-mobile is-flex is-flex-direction-column">
|
||||||
<div class="is-flex-grow-1 mb-3">
|
<div class="is-flex-grow-1 mb-3">
|
||||||
<span class="subtitle">{% if book.series_number %}{% blocktrans with series_number=book.series_number %}Book {{ series_number }}{% endblocktrans %}{% else %}{% trans 'Unsorted Book' %}{% endif %}</span>
|
<span class="subtitle">{% if book.series_number %}{% blocktrans with series_number=book.series_number %}Book {{ series_number }}{% endblocktrans %}{% else %}{% trans 'Unsorted Book' %}{% endif %}</span>
|
||||||
|
|
|
@ -6,14 +6,6 @@
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
|
|
||||||
{% with status_type=status.status_type %}
|
{% with status_type=status.status_type %}
|
||||||
<div
|
|
||||||
class="block"
|
|
||||||
{% if status_type == "Review" %}
|
|
||||||
itemprop="rating"
|
|
||||||
itemtype="https://schema.org/Rating"
|
|
||||||
{% endif %}
|
|
||||||
>
|
|
||||||
|
|
||||||
<div class="columns is-gapless">
|
<div class="columns is-gapless">
|
||||||
{% if not hide_book %}
|
{% if not hide_book %}
|
||||||
{% with book=status.book|default:status.mention_books.first %}
|
{% with book=status.book|default:status.mention_books.first %}
|
||||||
|
@ -58,9 +50,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
>
|
>
|
||||||
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
|
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
|
||||||
|
|
||||||
{# @todo Is it possible to not hard-code the value? #}
|
|
||||||
<meta itemprop="bestRating" content="5">
|
|
||||||
</span>
|
</span>
|
||||||
{% include 'snippets/stars.html' with rating=status.rating %}
|
{% include 'snippets/stars.html' with rating=status.rating %}
|
||||||
</h4>
|
</h4>
|
||||||
|
@ -154,6 +143,5 @@
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
>
|
>
|
||||||
<span class="is-hidden" {{ rating_type }}>
|
<span class="is-hidden" {{ rating_type }}>
|
||||||
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
|
<meta itemprop="ratingValue" content="{{ status.rating|floatformat }}">
|
||||||
|
|
||||||
{# @todo Is it possible to not hard-code the value? #}
|
|
||||||
<meta itemprop="bestRating" content="5">
|
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue