diff --git a/wagtailseo/models.py b/wagtailseo/models.py index 4df520d..f1d6f3d 100644 --- a/wagtailseo/models.py +++ b/wagtailseo/models.py @@ -325,7 +325,7 @@ class Meta: ), ) - @property + @cached_property def at_twitter_site(self): """ The Twitter site handle, prepended with "@". @@ -422,7 +422,7 @@ def get_preview_template(self, request, mode_name): # -- SEO properties ------------------------------------------------------- - @property + @cached_property def seo_author(self) -> str: """ Gets the name of the author of this page. @@ -432,7 +432,7 @@ def seo_author(self) -> str: return self.owner.get_full_name() return "" - @property + @cached_property def seo_canonical_url(self) -> str: """ Gets the full/absolute/canonical URL preferred for meta tags and search engines. @@ -445,7 +445,7 @@ def seo_canonical_url(self) -> str: return url return self.get_full_url() - @property + @cached_property def seo_description(self) -> str: """ Gets the correct search engine and Open Graph description of this page. @@ -458,7 +458,7 @@ def seo_description(self) -> str: return text return "" - @property + @cached_property def seo_image(self) -> Optional[AbstractImage]: """ Gets the primary Open Graph image of this page. @@ -473,7 +473,7 @@ def seo_image(self) -> Optional[AbstractImage]: return default return None - @property + @cached_property def seo_image_url(self) -> str: """ Gets the absolute URL for the primary Open Graph image of this page. @@ -494,7 +494,7 @@ class containing ``SeoOrgFields`` """ return SeoSettings.for_site(site=self.get_site()) - @property + @cached_property def seo_logo(self) -> Optional[AbstractImage]: """ Gets the primary logo of the organization. @@ -503,7 +503,7 @@ def seo_logo(self) -> Optional[AbstractImage]: return self.seo_org_fields.struct_org_logo return None - @property + @cached_property def seo_logo_url(self) -> str: """ Gets the absolute URL for the organization logo. @@ -514,7 +514,7 @@ def seo_logo_url(self) -> str: return utils.ensure_absolute_url(url, base_url) return "" - @property + @cached_property def seo_og_type(self) -> str: """ Gets the correct Open Graph type for this page. @@ -522,7 +522,7 @@ def seo_og_type(self) -> str: """ return self.seo_content_type.value - @property + @cached_property def seo_sitename(self) -> str: """ Gets the site name. @@ -533,7 +533,7 @@ def seo_sitename(self) -> str: return s.site_name return "" - @property + @cached_property def seo_pagetitle(self) -> str: """ Gets the correct search engine and Open Graph title of this page. @@ -550,7 +550,7 @@ def seo_pagetitle(self) -> str: self.title, settings.get("WAGTAILSEO_SEP"), self.seo_sitename ) - @property + @cached_property def seo_published_at(self) -> datetime: """ Gets the date this page was first published. @@ -558,7 +558,7 @@ def seo_published_at(self) -> datetime: """ return self.first_published_at - @property + @cached_property def seo_twitter_card_content(self) -> str: """ Gets the correct style of twitter card for this page. @@ -566,7 +566,7 @@ def seo_twitter_card_content(self) -> str: """ return self.seo_twitter_card.value - @property + @cached_property def seo_struct_org_name(self) -> str: """ Gets org name for structured data using a fallback. @@ -575,7 +575,7 @@ def seo_struct_org_name(self) -> str: return self.seo_org_fields.struct_org_name return self.seo_sitename - @property + @cached_property def seo_struct_org_base_dict(self) -> dict: """ Gets generic "Organization" data for use as a subset of other @@ -631,13 +631,13 @@ def seo_struct_org_base_dict(self) -> dict: return sd_dict - @property + @cached_property def seo_struct_org_base_json(self) -> str: return json.dumps( self.seo_struct_org_base_dict, cls=utils.StructDataEncoder ) - @property + @cached_property def seo_struct_org_dict(self) -> dict: """ Gets full "Organization" structured data on top of base organization data. @@ -693,18 +693,18 @@ def seo_struct_org_dict(self) -> dict: return sd_dict - @property + @cached_property def seo_struct_org_json(self) -> str: return json.dumps(self.seo_struct_org_dict, cls=utils.StructDataEncoder) - @property + @cached_property def seo_struct_publisher_dict(self) -> Optional[dict]: """ Gets the base organization info. """ return self.seo_struct_org_base_dict or None - @property + @cached_property def seo_struct_article_dict(self) -> dict: sd_dict = { "@context": "http://schema.org", @@ -739,7 +739,7 @@ def seo_struct_article_dict(self) -> dict: return sd_dict - @property + @cached_property def seo_struct_article_json(self) -> str: return json.dumps( self.seo_struct_article_dict, cls=utils.StructDataEncoder