Skip to content

itarverne/checklist-seo

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
seo
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Check list SEO Build

Maintainability Test Coverage

All the SEO check in app Django built for Wagtail

Features

Result Features
Keyword repartition
Length content
Check title article length
Url is optimized
Number internal Links

Installation

Pypi

PyPI version

pip install checklist-seo

Installing the application in Django

To use this application, you need first to add it to your config file.

In your config file (ex: settings.py):

# Application definition

INSTALLED_APPS = [
	...
	'seo'
	...
]

SEO Panel

To setup the keyword for SEO, you need to add a special SEO Panel that will appear in your page creation in wagtail admin.

The module contains a model in models/SeoPage, the model need to be used as a base for your page models.

Example of your model:

class HomePage(SeoPage):
    date = models.DateField("Post date")
    intro = models.CharField(max_length=250)
    delay = models.IntegerField(default=0, validators=[MaxValueValidator(99), MinValueValidator(0)])
    body = StreamField([
        ('text', RichTextBlock(blank=True, features=['h2', 'h3', 'h4', 'bold', 'italic', 'link',
                                                     'code', 'ol', 'ul', 'hr', 'document-link', 'image', 'embed', 'superscript', 'subscript', 'strikethrough', 'blockquote'])),
        ('rawHtml', RawHTMLBlock(blank=True)),
    ], blank=True)
    images_keyword = models.CharField(max_length=250, blank=True)
    selected_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+'
    )

    keep_slug = models.BooleanField(
        verbose_name=('Keep current slug'),
        default=False,
        help_text=("Keep current slug or save to generate a new slug.")
    )

    def _get_autogenerated_slug(self, base_slug):
        """Redefinition of wagtail's _get_autogenerated_slug so you can use your own slug generator."""
        return self.slug

    search_fields = Page.search_fields + [
        index.SearchField('intro'),
    ]

    content_panels = Page.content_panels + [
        MultiFieldPanel([
            FieldPanel('date'),
            FieldRowPanel([
                FieldPanel('delay'),
            ]),
        ], heading="Blog information"),
        FieldPanel('intro'),
        StreamFieldPanel('body'),
        FieldRowPanel([
            FieldPanel('images_keyword'),
        ], heading="Images"),
        ImageChooserPanel(field_name="selected_image", heading="Image sélectionnée"),
    ]

    promote_panels = [
        MultiFieldPanel([
            FieldPanel('slug'),
            FieldPanel('keep_slug'),
            FieldPanel('seo_title'),
            FieldPanel('show_in_menus'),
            FieldPanel('search_description'),
        ], heading="Common Page Configuration"),
    ]

    edit_handler = TabbedInterface([
        ObjectList(content_panels, heading='Content'),
        ObjectList(promote_panels, heading="Promote"),
        SeoPage.seo_object_list,
        ObjectList(Page.settings_panels, heading='Settings')
    ])

Routing

In your routing projet file urls.py

from django.conf.urls import url
from django.urls import include

urlpatterns = [
    ...
    url(r'^seo/', include('seo.urls'), name='seo'),
]

Static

To get the CSS / JS / Image file from this app to your projet python manage.py collectstatic

DB Migration

Now you can detect the change python manage.py makemigrations

And apply it on DB python manage.py migration

Test

pytest

About

🔎 The full checklist to provide tools inside Django in order to write right content

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published