From be4137aa7be1d5d67875b8e103ea96f2831ca062 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 20 Dec 2016 19:03:58 +0000 Subject: [PATCH] Add short description for meta --- project/common/models.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/project/common/models.py b/project/common/models.py index 3fe2440..a68fedc 100644 --- a/project/common/models.py +++ b/project/common/models.py @@ -29,8 +29,16 @@ class Entity(MetadataPageMixin, Page): ], 'Common page configuration'), ] + @property + def short_body(self): + body_words = str(self.body).split(' ') + return ' '.join(body_words[:30]) # limit to 30 words (ish) + def get_meta_image(self): return self.image + def get_meta_description(self): + return self.search_description or self.short_body + class Meta: abstract = True