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): """ diff --git a/icekit/publishing/admin.py b/icekit/publishing/admin.py index 18c37ec7..da29ad65 100644 --- a/icekit/publishing/admin.py +++ b/icekit/publishing/admin.py @@ -20,8 +20,6 @@ from fluent_pages.adminui.pageadmin import _select_template_name from fluent_pages.adminui.urlnodeparentadmin import UrlNodeParentAdmin -from icekit.admin_mixins import FluentLayoutsMixin - from .models import PublishingModel @@ -723,6 +721,9 @@ class ICEKitFluentPagesParentAdminMixin( list_filter = (PublishingStatusFilter, PublishingPublishedFilter) +# this import must go here to avoid import errors +from icekit.admin_mixins import FluentLayoutsMixin + class PublishableFluentContentsAdmin(PublishingAdmin, FluentLayoutsMixin): """ Add publishing admin features for models with Fluent Contents features