Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add product schema.org attributes

Michal Ociepkab53eae4e745f
diff --git a/product/templates/product/details.html b/product/templates/product/details.html
index 832827cce9..122b88243a 100644
--- a/product/templates/product/details.html
+++ b/product/templates/product/details.html
@@ -2,29 +2,40 @@
{% load i18n %}
{% load gross from prices %}
-{% block content %}
-<h1>{{ product }}</h1>
-<p>Price: {% gross product.price %}</p>
-<form class="form-horizontal" method="post" action=".">
- {% csrf_token %}
- <div class="control-group {{ form.quantity.html_name }}{{ form.quantity.html_name }}{{ form.quantity.html_name }}{% if form.quantity.errors %} error{% endif %}{% if form.quantity.field.required %} required{% endif %}">
- <label class="control-label" for="inputEmail">{{ form.quantity.label }}</label>
- <div class="controls">
- {{ form.quantity }}
- {% if form.quantity.errors %}
- {% for error in form.quantity.errors %}
- <span class="help-inline error">{{ error }}</span>
- {% endfor %}
- {% endif %}
+{% block outercontent %}
+<div itemscope itemtype="http://schema.org/Product" class="row">
+ <h1 itemprop="name">{{ product }}</h1>
+ <p itemprop="offers" itemscope itemtype="http://schema.org/Offer">
+ Price: <span itemprop="price">{% gross product.price %}</span>
+ {% if product.stock == 0 %}
+ <link itemprop="availability" href="http://schema.org/OutOfStock" />
+ Out of stock
+ {% else %}
+ <link itemprop="availability" href="http://schema.org/InStock" />
+ In stock
+ {% endif %}
+ </p>
+ <form class="form-horizontal" method="post" action=".">
+ {% csrf_token %}
+ <div class="control-group {{ form.quantity.html_name }}{{ form.quantity.html_name }}{{ form.quantity.html_name }}{% if form.quantity.errors %} error{% endif %}{% if form.quantity.field.required %} required{% endif %}">
+ <label class="control-label" for="inputEmail">{{ form.quantity.label }}</label>
+ <div class="controls">
+ {{ form.quantity }}
+ {% if form.quantity.errors %}
+ {% for error in form.quantity.errors %}
+ <span class="help-inline error">{{ error }}</span>
+ {% endfor %}
+ {% endif %}
+ </div>
</div>
- </div>
- <div class="control-group">
- <div class="controls">
- <button class="btn">
- {% trans "Add to cart" %}
- </button>
+ <div class="control-group">
+ <div class="controls">
+ <button class="btn">
+ {% trans "Add to cart" %}
+ </button>
+ </div>
</div>
- </div>
-</form>
-{% endblock content %}
+ </form>
+</div>
+{% endblock outercontent %}