improve structured SEO data, v39

This commit is contained in:
Konstantin 2024-04-11 11:19:51 +02:00
parent a498c81e99
commit a5372e1238
3 changed files with 18 additions and 2 deletions

View file

@ -1,3 +1,5 @@
from typing import Optional
from django import forms
from django.db import models
from modelcluster.fields import ParentalKey, ParentalManyToManyField
@ -95,6 +97,19 @@ class BlogPage(SeoMixin, Page):
promote_panels = SeoMixin.seo_panels
seo_content_type = SeoType.ARTICLE
@property
def seo_author(self) -> str:
return ', '.join([author.name for author in self.authors.all()])
@property
def seo_canonical_url(self) -> str:
# replace http:// with https://
return super().seo_canonical_url.replace('http://', 'https://')
@property
def seo_struct_publisher_dict(self) -> Optional[dict]:
return None
class BlogPageGalleryImage(Orderable):
page = ParentalKey(BlogPage, on_delete=models.CASCADE, related_name='gallery_images')