From 2288fba79c9e6f1c73787efb2aa44fa3ee7e37a4 Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Mon, 2 Oct 2023 10:41:38 +0200 Subject: [PATCH] :ok_hand: [#1750] PR feedback * Add extra meta tags for sharing (description, image, page and type) --- src/open_inwoner/pdc/views.py | 3 +++ src/open_inwoner/templates/master.html | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/open_inwoner/pdc/views.py b/src/open_inwoner/pdc/views.py index 4c097fa464..82b3fe3277 100644 --- a/src/open_inwoner/pdc/views.py +++ b/src/open_inwoner/pdc/views.py @@ -201,6 +201,7 @@ def crumbs(self): def get_context_data(self, **kwargs): product = self.get_object() context = super().get_context_data(**kwargs) + request = context["view"].request subheadings = extract_subheadings(product.content, tag="h2") @@ -217,6 +218,8 @@ def get_context_data(self, **kwargs): anchors.append(("#contact", _("Contact"))) context["meta_description"] = product.summary + context["meta_image_url"] = request.build_absolute_uri(product.icon.url) + context["meta_page_url"] = request.build_absolute_uri(request.path) context["anchors"] = anchors context["related_products_start"] = 6 if product.links.exists() else 1 context["product_links"] = product.links.order_by("pk") diff --git a/src/open_inwoner/templates/master.html b/src/open_inwoner/templates/master.html index b2f023cf91..bc191f29a0 100644 --- a/src/open_inwoner/templates/master.html +++ b/src/open_inwoner/templates/master.html @@ -10,7 +10,17 @@ {% if meta_description %} + {% endif %} + {% if meta_image_url %} + + + {% endif %} + {% if meta_page_url %} + + {% endif %} + + {% if favicon %} {% endif %}