add SEO
This commit is contained in:
parent
8f5d475dd4
commit
bc2be24e7e
9 changed files with 325 additions and 6 deletions
18
blog/migrations/0011_alter_blogpage_intro.py
Normal file
18
blog/migrations/0011_alter_blogpage_intro.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 5.0.2 on 2024-03-23 15:34
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('blog', '0010_alter_blogpage_body'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='blogpage',
|
||||
name='intro',
|
||||
field=models.TextField(),
|
||||
),
|
||||
]
|
File diff suppressed because one or more lines are too long
|
@ -12,9 +12,9 @@ from wagtail.search import index
|
|||
from wagtail.snippets.models import register_snippet
|
||||
|
||||
from blog.blocks import BlogPostBlock
|
||||
from wagtailseo.models import SeoMixin, SeoType
|
||||
|
||||
|
||||
class BlogIndexPage(Page):
|
||||
class BlogIndexPage(SeoMixin, Page):
|
||||
intro = RichTextField(blank=True)
|
||||
|
||||
def get_context(self, request):
|
||||
|
@ -27,6 +27,7 @@ class BlogIndexPage(Page):
|
|||
content_panels = Page.content_panels + [
|
||||
FieldPanel('intro')
|
||||
]
|
||||
promote_panels = SeoMixin.seo_panels
|
||||
|
||||
class BlogTagIndexPage(Page):
|
||||
|
||||
|
@ -46,7 +47,7 @@ class BlogPageTag(TaggedItemBase):
|
|||
on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
class BlogPage(Page):
|
||||
class BlogPage(SeoMixin, Page):
|
||||
date = models.DateField("Post date")
|
||||
intro = models.TextField()
|
||||
body = StreamField(
|
||||
|
@ -83,6 +84,9 @@ class BlogPage(Page):
|
|||
InlinePanel('gallery_images', label="Gallery images"),
|
||||
]
|
||||
|
||||
promote_panels = SeoMixin.seo_panels
|
||||
seo_content_type = SeoType.ARTICLE
|
||||
|
||||
|
||||
class BlogPageGalleryImage(Orderable):
|
||||
page = ParentalKey(BlogPage, on_delete=models.CASCADE, related_name='gallery_images')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue