From bfaff0d6b758331281df990f8f83d044691f663a Mon Sep 17 00:00:00 2001 From: Sam Minton Date: Tue, 6 Dec 2016 10:37:15 +1100 Subject: [PATCH] Add OG tags content to ListableMixin --- icekit/mixins.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/icekit/mixins.py b/icekit/mixins.py index 0d6ae4bb..b05e796a 100644 --- a/icekit/mixins.py +++ b/icekit/mixins.py @@ -200,6 +200,23 @@ def get_boosted_search_terms(self): def get_oneliner(self): return getattr(self, 'oneliner', "") + def get_og_title(self): + """ + return meta_title if exists otherwise fall back to title + """ + if hasattr(self, 'meta_title') and self.meta_title: + return self.meta_title + return self.get_title() + + def get_og_image(self): + return self.get_list_image() + + def get_og_desciption(self): + if hasattr(self, 'meta_description') and self.meta_description: + return self.meta_description + return self.get_oneliner() + + class HeroMixin(models.Model): """