Giter Club home page Giter Club logo

djangocms-page-sitemap's Introduction

djangocms-page-sitemap

Join the Gitter chat Latest PyPI version Python versions Latest Travis CI build status Test coverage Code Climate License

django CMS page extension to handle sitemap customization

Support Python version:

  • Python 3.7, 3.8, 3.9, 3.10

Supported Django versions:

  • Django 2.2, 3.2

Supported django CMS versions:

  • django CMS 3.7 - 3.10

Note

djangocms-page-sitemap 0.8 has been relicensed with BSD license.

Note

djangocms-page-sitemap 1.0 dropped compatibility with Python 2 and Django < 2.2

Features

  • Support for changefreq and priority customisation per-page
  • Option to exclude a page from the Sitemap
  • Values are cached
  • django CMS toolbar integration
  • Available on Divio Cloud

Quickstart

  • Install djangocms-page-sitemap:

    pip install djangocms-page-sitemap
    
  • Add to INSTALLED_APPS with django.contrib.sitemaps:

    INSTALLED_APPS = [
        ...
        "django.contrib.sitemaps",
        "djangocms_page_sitemap",
    ]
  • Load it into the urlconf, eventually removing django CMS sitemap:

    ...
    urlpatterns = [
        path("admin/", admin.site.urls),
        ...
        path("", include("djangocms_page_sitemap.sitemap_urls")),
        ...
    ]
  • Load robots_index templatetag and add it to the page in the head tag of the django CMS pages (or in a shared base template):

    {% load robots_index %}
    
    ...
    <head>
    <!-- somewhere in the head tag -->
    {% page_robots %}
    </head>
     ...
  • If you need to provide a custom sitemap configuration (for example to add more sitemap classes to it, you can append the sitemap url explicitly:

    from django.contrib.sitemaps.views import sitemap
    from djangocms_page_sitemap.sitemap import ExtendedSitemap
    from myapp.sitemaps import MySiteSitemap
    
    urlpatterns = [
        ...
        path("sitemap.xml", sitemap, {
            "sitemaps": {
                "cmspages": ExtendedSitemap, "myapp": MySiteSitemap,
            }
        ),
        ...
    ]

django-app-enabler support

django-app-enabler is supported.

You can either

  • Installation & configuration: python -mapp_enabler install djangocms-page-meta
  • Autoconfiguration: python -mapp_enabler enable djangocms_page_meta

Fully using this package will require some changes that cannot be modified by django-app-enabler:

  • Remove any existing sitemap declaration from urls.py;
  • Load robots tags in the page like outlined above;
  • Run migrations: python manage.py migrate

Check documentation above for details.

Usage

After installing as above, you will be able to tune the sitemap setting for each page.

A new menu item Sitemap properties will be available in the page toolbar.

For each page you will be able to set the following flags / values:

  • Sitemap changefreq (default: the django CMS default)
  • Sitemap priority (default: 0.5)
  • Include page in sitemap (default: True)
  • Set noindex value to page robots meta tag
  • Set noarchive value to page robots meta tag
  • Provide any additional robots meta tag values

page_robots options

page_robots meta tag accepts the following parameters:

  • page: the page to render robots meta tag (default: current page). Can be any valid page lookup
  • site: the current site id (default: current site).

Settings

  • PAGE_SITEMAP_CHANGEFREQ_LIST: List of frequency changes
  • PAGE_SITEMAP_DEFAULT_CHANGEFREQ: Default changefrequency (default: django CMS value -monthly-)
  • PAGE_SITEMAP_CACHE_DURATION: Cache duration: same as django CMS menu cache)

djangocms-page-sitemap's People

Contributors

dependabot-preview[bot] avatar fp4code avatar kinkerl avatar protoroto avatar satyrius avatar yakky avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.