A small Django app to manage sitemap.xml overrides on a per-object basis
Project description
A small Django app to manage sitemap.xml overrides on a per-object basis.
Requirements
Django 1.6 or greater, Python 2.7 or greater.
Installation
Use your favorite Python installer to install it from PyPI:
$ pip install django-sitemapper
Or get the source from the application site:
$ hg clone https://bitbucket.org/mhurt/django-sitemapper $ cd django-sitemapper $ python setup.py install
Configuration
Add "sitemapper" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = { ... 'sitemapper' }
For Django 1.7 users, run python manage.py migrate to create the models. Otherwise simply run python manage.py syncdb.
Setting up a sitemap
Create a sitemaps.py file within your app directory and add the following (replacing MyModel with whatever you called yours):
# sitemaps.py from sitemapper.mixins import Sitemap from .models import MyModel class MyModelSitemap(Sitemap): # Set some defaults for your model's sitemap... default_changefreq = 'weekly' default_priority = 0.5 # ... and the queryset you want to use... queryset = MyModel.objects.all() # ... and some means to access the last-modified timestamp. def lastmod(self, obj): return obj.lastmodified
From this point onwards you can use MyModelSitemap as you would any other sitemaps instance. See Django’s sitemaps documentation for how to wire this up with your urlconf.
Contribute
Issue Tracker: https://bitbucket.org/mhurt/django-sitemapper/issues
Source Code: https://bitbucket.org/mhurt/django-sitemapper/
License
The project is licensed under the MIT license.
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
Hashes for django-sitemapper-1.0.0-alpha.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06355e63e790ba10788689fac2e264ca5a613c74a2a2a861820858b5cc6b2988 |
|
MD5 | 3ab890686f8a28b227d84ab7b7aadd3e |
|
BLAKE2b-256 | 315257ea322ced0a464e44660cf9893b8ea985f5eeec2d4deef4d6ff062e0d9d |