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
Requirements
The only requirement is Django 1.3+. App should work with older Django versions with some settings tweaks. In matter of fact just defining STATICSITEMAPS_ROOT_DIR (in case you have no STATIC_ROOT defined) should be enough.
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.
Note: Your sitemap files will be served from STATIC_URL by default. If your STATIC_URL is a relative one (e.g. /static/), the result will be prepended the domain to respect the current Site object. If your STATIC_URL is absolute (generally doesn’t start with a ‘/’), sitemaps URL will respect it completely. If you need more detailed control, see STATICSITEMAPS_DOMAIN setting.
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_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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-static-sitemaps-1.3.0.tar.gz
.
File metadata
- Download URL: django-static-sitemaps-1.3.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 592d42371bf154212e8c2fc79972fa3e5a2fd97f092521c574212396ad31f06f |
|
MD5 | 16dac6cc6683c7d782fe17f30932f5d9 |
|
BLAKE2b-256 | f7c172ca17d8dd5b07662e6b0871b70301f129fac32ec213a282266f3cade473 |