Skip to main content

django CMS page extension to handle sitemap customization

Project description

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 2.7, 3.5, 3.6, 3.7

Supported Django versions:

  • Django 1.11 to 2.2

Supported django CMS versions:

  • django CMS 3.6+

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',
    ]
  • Add to the urlconf, eventually removing django CMS sitemap:

    from djangocms_page_sitemap import sitemap_urls
    
    ...
    
    urlpatterns = [
        url(r'^admin/', include(admin.site.urls)),
        ...
        url(r'^', include(sitemap_urls)),
        ...
    ]
  • Add the following snippets to the django CMS templates:

    {% 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 = patterns(
        '',
        ...
        url(r'^sitemap\.xml$', sitemap,
            {'sitemaps': {
                'cmspages': ExtendedSitemap, 'myapp': MySiteSitemap,
            }
        }),
    )
  • Add the following snippets to the django CMS templates:

    {% load robots_index %}
    
     ...
    <head>
    <!-- somewhere in the head tag -->
    {% page_robots %}
    </head>
    ...

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 noarchite 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)

History

0.7.0 (2019-08-22)

  • Add compatibility with Django 2.2

  • Drop compatibility with Django < 1.11

  • Drop compatibility with django CMS < 3.6

  • Move to django-app-helper

0.6.0 (2019-07-13)

  • Drop compatibility with Django < 1.11

  • Drop compatibility with Python 3 < 3.5

0.5.4 (2019-07-13)

  • Fix error when page_robots is executed outside a request

  • Fix tox for older environments

0.5.3 (2019-03-09)

  • Add Django 2.0, 2.1 support

  • Add django CMS 3.6 support

  • Apply workaround to avoid triggering Page.site_id deprecation warning

0.5.2 (2018-04-07)

  • Make robots_extra not required

0.5.1 (2018-02-27)

  • Fix error in migration dependencies

0.5.0 (2018-02-22)

  • Add Django 1.11 support

  • Add django CMS 3.5 support

  • Package as Divio Cloud addon

  • Add support for noindex, noarchive robots meta tag

0.4.3 (2019-07-13)

  • Fix error when page_robots is executed outside a request

  • Fix tox for older environments

0.4.2 (2019-04-08)

  • Add support for noindex, noarchive robots meta tag

0.4.1 (2016-12-02)

  • Add Django 1.10 support

0.4.0 (2016-10-26)

  • Drop compatibility with django CMS 3.1 and below, Django 1.7 and below

0.3.1 (2015-10-18)

  • Improve defaults

0.3.0 (2015-10-18)

  • Add Python 3.5

  • Add option to exclude page from sitemap

0.2.0 (2015-08-15)

  • Update to support django CMS 3.1

  • Drop support for Django 1.4, 1.5

  • Add support for Django 1.8

0.1.0 (2014-08-26)

  • Initial version.

Project details


Download files

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

Source Distribution

djangocms-page-sitemap-0.7.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

djangocms_page_sitemap-0.7.0-py2.py3-none-any.whl (20.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file djangocms-page-sitemap-0.7.0.tar.gz.

File metadata

  • Download URL: djangocms-page-sitemap-0.7.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for djangocms-page-sitemap-0.7.0.tar.gz
Algorithm Hash digest
SHA256 69e079cbc6829e854e381c4af91c401672a427cd89186e1be2ccd6d56c1a1d3c
MD5 ffd6087b6b66794a829f81c6bd6218ec
BLAKE2b-256 809b3a60ccb48164229b3015e7dfb1d049ec30fa525800c57c0219e78e7ee083

See more details on using hashes here.

File details

Details for the file djangocms_page_sitemap-0.7.0-py2.py3-none-any.whl.

File metadata

  • Download URL: djangocms_page_sitemap-0.7.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for djangocms_page_sitemap-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ed424e96d0f44fcedde075ce18f3bca6870d0dff19f36cbc805e1b23ae9bf9c3
MD5 9d060b37f67cb249f13eac93d8b38008
BLAKE2b-256 9e7518e512b1f0b02b5f25af31b96febefa911d4ca5fdde6f194d89ae6a98b71

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