Skip to main content

JSL Django Sitemap

Upload Python Package

A sitemap is an XML file on your website that tells search-engine crawlers or indexers how frequently your pages change and how “important” certain pages are in relation to other pages on your site. This information helps search engines index your site.

This Django sitemap framework library automates the creation of this XML file by letting you express this information in Python code. You have the ability to chnge and mention settings in your Django project's settings.py file. It is very convinent and easy to use library which detects the changes in your Django url configuration and reloads the new configuration making absolutely no manual interventions for your sitemap.

JSL Django Sitemap is a sitemap.xml creator for Django projects which iterates over all the url patterns in your main Django project and creates a ready to use sitemap. The sitemap.xml is useful in crawlers such as Google, Bing, Yahoo. We hope you like our app! Leave a star on our GitHub repository. Thanks!

Our Home page JSoftwareLabs.com

Installation

You can install the JSL Django Sitemap from PyPI:

pip install jsl-django-sitemap

Example Usage

Add necessary imports

from jsl_django_sitemap.views import sitemaps
from django.contrib.sitemaps.views import sitemap
from django.urls import path

In your main django project urls.py file add below in urlpatterns

path('sitemap.xml', sitemap, {'sitemaps': sitemaps},
name='django.contrib.sitemaps.views.sitemap'),

In your main settings.py file add below

JSL_DJANGO_SITEMAP_SETTINGS = {
	"ENABLE": True,
	"FETCH_URL_FROM": "pattern",
	"INCLUDE_APPS": ("ALL",),
	"IGNORE_URL_PATTERNS": (".*/api/v1.*", )
}

add django built in sitemap in the INSTALLED_APPS

INSTALLED_APPS = [
	# ...
	'django.contrib.sitemaps',
]

NOTE:

  1. "ALL" means to include all the urls
  2. If you want specific apps to be included in sitemap use below. Provide comma separated tuple containing your app name
  3. "INCLUDE_APPS": ("myapp1","myapp2")
  4. FETCH_URL_FROM: should be one value from the list ["name", "pattern"]
  5. default for FETCH_URL_FROM is "pattern"
  6. By default, if pattern is provided then "^" prefix and "$" suffix in urlpattern is removed.
  7. "IGNORE_URL_PATTERNS": ("./api/v1.", ) This flag is used to ignore certain urls matching the provided tuple of patterns which are regex compatible NOTE: The sitemap application doesn't install any database tables. The only reason it needs to go into INSTALLED_APPS is so that the Loader() template loader can find the default templates.

View generated sitemap:

Start the development server and visit http://127.0.0.1:8000/sitemap.xml


Current Releases

1.2.4

How to build and distribute using sdist setup.py and twine

python3 -m pip install --upgrade twine
python setup.py sdist
twine upload dist/*

Release files for jsl-django-sitemap 1.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jsl-django-sitemap 1.2.4
File Size Uploaded
jsl_django_sitemap-1.2.4.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jsl-django-sitemap 1.2.4
File Interpreter ABI Platform
jsl_django_sitemap-1.2.4-py3-none-any.whl Python 3 none any Details

Total release size:13.2 kB

Release files / jsl_django_sitemap-1.2.4.tar.gz

Download URL jsl_django_sitemap-1.2.4.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0a4468fe8f9a6d1604257759940fb3776568c4d4fcb18bca8ad5ab7440495d2d
BLAKE2b-256 checksum
How to use checksums
0705e0d168b85a311d377e2fd86ccfc69728ff1bbce070d7e97c93be943ae15d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / jsl_django_sitemap-1.2.4-py3-none-any.whl

Download URL jsl_django_sitemap-1.2.4-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc565cee800b97a1c9f19dd1c329c9e8956bf8d6b4499cfa4ada7aaa61945098
BLAKE2b-256 checksum
How to use checksums
6fdbeac1e409e136852a8e666a20215385dc7514e3f2afa8b17f0595ddc0d7c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.2.4 This release

2 release files

1.2.0

1 release file

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page