Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Move build_absolute_url to templatetag
Pacu222ae8fd45ab4
diff --git a/saleor/core/templatetags/urls.py b/saleor/core/templatetags/urls.pynew file mode 100644index 0000000000..3991c8786f--- /dev/null+++ b/saleor/core/templatetags/urls.py@@ -0,0 +1,11 @@+from __future__ import unicode_literals++from django import template++register = template.Library()+++def build_absolute_uri(request, location):+ return request.build_absolute_uri(location)+diff --git a/templates/category/index.html b/templates/category/index.htmlindex 73f580d4f4..aa7a4d5ebc 100644--- a/templates/category/index.html+++ b/templates/category/index.html@@ -3,8 +3,8 @@{% load i18n %}{% load shop %}{% load staticfiles %}-{% load render_bundle from webpack_loader %}{% load prices_i18n %}+{% load build_absolute_uri from urls %}{% block footer_scripts %}{{ block.super }}@@ -17,18 +17,17 @@<meta property="og:description" content="{{ category.description }}"><meta property="og:image" content="{% static "images/block1.png" %}">- {% with category_url=category.get_full_absolute_url %}- <meta property="og:url" content="{{ category_url }}">- <link rel="canonical" href="{{ category_url }}?page={{ products_paginated.number }}">+ {% build_absolute_uri request=request location=category.get_absolute_url as category_url %}+ <meta property="og:url" content="{{ category_url }}">+ <link rel="canonical" href="{{ category_url }}?page={{ products_paginated.number }}">- {% if products_paginated.has_previous %}- <link rel="prev" href="{{ category_url }}?page={{ products_paginated.previous_page_number }}">- {% endif %}+ {% if products_paginated.has_previous %}+ <link rel="prev" href="{{ category_url }}?page={{ products_paginated.previous_page_number }}">+ {% endif %}- {% if products_paginated.has_next %}- <link rel="next" href="{{ category_url }}?page={{ products_paginated.next_page_number }}">- {% endif %}- {% endwith %}+ {% if products_paginated.has_next %}+ <link rel="next" href="{{ category_url }}?page={{ products_paginated.next_page_number }}">+ {% endif %}{% endblock meta_tags %}{% block breadcrumb %}diff --git a/templates/product/details.html b/templates/product/details.htmlindex 2eb553b760..2748a14b94 100644--- a/templates/product/details.html+++ b/templates/product/details.html@@ -6,7 +6,8 @@{% load markdown from markdown %}{% load price_range from price_ranges %}{% load staticfiles %}-{% load get_thumbnail from product_images %}+{% load get_thumbnail product_first_image from product_images %}+{% load build_absolute_uri from urls %}{% block title %}{{ product }} — {{ block.super }}{% endblock %}@@ -16,10 +17,9 @@<meta property="og:title" content="{{ product }} — {{ block.super }}"><meta property="og:description" content="{{ product.description }}">- {% with product_url=product.get_full_absolute_url %}- <meta property="og:url" content="{{ product_url }}">- <link rel="canonical" href="{{ product_url }}">- {% endwith %}+ {% build_absolute_uri request=request location=product.get_absolute_url as product_url %}+ <meta property="og:url" content="{{ product_url }}">+ <link rel="canonical" href="{{ product_url }}">{% product_first_image product size="510x510" as product_image %}{% if product_image %}