Skip to main content

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

Project description

Check list SEO Build

Maintainability Test Coverage

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 Pannel

To setup the keyword for SEO, you need to add a special SEO Pannel 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'), ]

DB Migration

Now you can detect the change python manage.py makemigrations

And apply it on DB python manage.py migration

Test

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

checklist_seo-0.0.5-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file checklist_seo-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: checklist_seo-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7

File hashes

Hashes for checklist_seo-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aea9530965c815d0b4fd25d6958491fcef68839c066c79575ef315d94c612f69
MD5 d0c945bfc7dca6c40b240bbfc7626301
BLAKE2b-256 62faf9f4c7023183717ccdd2a202dcc39e99164593689967dddbc0c255f9e6cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page