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,5 +1,5 @@
.PHONY: help build publish .PHONY: help build publish
VERSION = 1.0.38 VERSION = 1.0.39
help: help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

View file

@ -1,3 +1,5 @@
from typing import Optional
from django import forms from django import forms
from django.db import models from django.db import models
from modelcluster.fields import ParentalKey, ParentalManyToManyField from modelcluster.fields import ParentalKey, ParentalManyToManyField
@ -95,6 +97,19 @@ class BlogPage(SeoMixin, Page):
promote_panels = SeoMixin.seo_panels promote_panels = SeoMixin.seo_panels
seo_content_type = SeoType.ARTICLE 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): class BlogPageGalleryImage(Orderable):
page = ParentalKey(BlogPage, on_delete=models.CASCADE, related_name='gallery_images') page = ParentalKey(BlogPage, on_delete=models.CASCADE, related_name='gallery_images')

View file

@ -3,7 +3,7 @@ from django.db import models
from wagtail.models import Page from wagtail.models import Page
from wagtail.fields import RichTextField, StreamField from wagtail.fields import RichTextField, StreamField
from wagtail.admin.panels import FieldPanel, MultiFieldPanel from wagtail.admin.panels import FieldPanel, MultiFieldPanel
from wagtailseo.models import SeoMixin from wagtailseo.models import SeoMixin, SeoType
from .blocks import HomeContentBlock from .blocks import HomeContentBlock
@ -56,3 +56,4 @@ class HomePage(SeoMixin, Page):
] ]
promote_panels = SeoMixin.seo_panels promote_panels = SeoMixin.seo_panels
seo_content_type = SeoType.WEBSITE