Skip to content

Stennsen/djangocms-page-sitemap

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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+

Note

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

Note

djangocms-page-sitemap 0.7 dropped compatibility with django CMS < 3.6. 0.6.x releases will be made if necessary after 0.6 release.

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)

About

django CMS page extension to handle sitemap customization

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.8%
  • Gherkin 0.2%