Skip to main content

UNKNOWN

Project description

There are times when your site is too big to serve the sitemap.xml by your Django application. This little app is meant to help you with such cases. Instead of serving the sitemap.xml from Django, it features a management command that generates the sitemap.xml to the separate files.

Feature highlights:

  • Generate sitemap files to your STATIC/MEDIA/(own choice) directory

  • Split sitemap files when limit for size is reached

  • Gzip the sitemap files when required

  • Set different domain for sitemap file

  • Ping google that sitemap has changed

Usage

Install via standard Python way:

pip install django-static-sitemaps

Add to you INSTALLED_APPS:

INSTALLED_APPS = (
        ...
        'static_sitemaps',
        ...
)

Set STATICSITEMAPS_ROOT_SITEMAP variable in your settings.py to point to dictionary holding the sitemaps configuration (as seen in Django docs):

STATICSITEMAPS_ROOT_SITEMAP = 'myproject.sitemaps.sitemaps'

Include static_sitemaps.urls to your urls.py to serve the root sitemap.xml if you want to serve index file through Django (might be usefull sometimes when it’s hard for you to serve it by webserver itself):

urlpatterns = patterns('',
        url(r'^sitemap.xml', include('static_sitemaps.urls')),
)

Setup your cron to run:

django-admin.py refresh_sitemap

periodically. Usually, it’s enough to set it to run once by 30 minutes or so.

Done.

Advanced settings

STATICSITEMAPS_ROOT_DIR

Filesystem path to generate the sitemaps files to. Defaults to STATIC_ROOT directory.

STATICSITEMAPS_USE_GZIP

Defaults to True. If True, gzip compression will be used when generating the sitemaps files (which is very possible by sitemaps specification).

STATICSITEMAPS_FILENAME_TEMPLATE

Template for sitemap parts. Defaults to sitemap-%(section)s-%(page)s.xml.

STATICSITEMAPS_SITEMAP_DOMAIN

Set this to the domain from which you serve static files in case it it different from domain of your Django application. Defaults to current site’s domain.

STATICSITEMAPS_LANGUAGE

Language code to use when generating the sitemaps. Defaults to LANGUAGE_CODE setting.

STATICSITEMAPS_PING_GOOGLE

Boolean determining whether to ping google after sitemaps have been updated. Defaults to True.

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

django-static-sitemaps-1.1.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file django-static-sitemaps-1.1.tar.gz.

File metadata

File hashes

Hashes for django-static-sitemaps-1.1.tar.gz
Algorithm Hash digest
SHA256 4448b424531ddddf2e0488763bd67e3a712debdac33c0454da62d49188196724
MD5 8b3ae91bcd8a9d8ba731a39b73c035d6
BLAKE2b-256 e7a15fc6bf2967cc260feb52d531cd0c2d88cd29b9c5d9e00c76b1f19eb75ebc

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