From f16c6853369bad7fbef05f577e27d24014ed8c91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com>
Date: Thu, 20 May 2021 16:59:23 +0200
Subject: [PATCH] elections2021: Metadata tweaks

---
 elections2021/models.py | 6 ++++++
 majak/settings/base.py  | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/elections2021/models.py b/elections2021/models.py
index 84db38d2..d680316e 100644
--- a/elections2021/models.py
+++ b/elections2021/models.py
@@ -1,4 +1,5 @@
 import json
+import re
 from functools import cached_property
 
 from django import forms
@@ -1696,6 +1697,11 @@ class Elections2021ProgramPointPage(SubpageMixin, MetadataPageMixin, Page):
     class Meta:
         verbose_name = "ProgramovĂ˝ bod"
 
+    def get_meta_description(self):
+        if self.search_description:
+            return self.search_description
+        return re.sub(r"<.*?>|\[.*?\]", "", self.annotation)
+
     @property
     def archetype(self):
         if self.weight_ministry_transport:
diff --git a/majak/settings/base.py b/majak/settings/base.py
index 13e42d36..20090bac 100644
--- a/majak/settings/base.py
+++ b/majak/settings/base.py
@@ -240,6 +240,8 @@ CAPTCHA_LETTER_ROTATION = (-20, 20)
 CAPTCHA_FONT_SIZE = 30
 CAPTCHA_IMAGE_SIZE = (120, 47)
 
+# meta image size
+WAGTAILMETADATA_IMAGE_FILTER = "max-1600x1600"
 
 # CUSTOM APPS SETTINGS
 # ------------------------------------------------------------------------------
-- 
GitLab