{"id":20053031,"url":"https://github.com/xaralis/django-static-sitemaps","last_synced_at":"2025-04-04T09:09:03.850Z","repository":{"id":2988727,"uuid":"4005055","full_name":"xaralis/django-static-sitemaps","owner":"xaralis","description":"Tool for generating sitemaps as static files to serve them from webserver instead of your Django application.","archived":false,"fork":false,"pushed_at":"2024-07-14T19:25:23.000Z","size":101,"stargazers_count":154,"open_issues_count":8,"forks_count":75,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T08:06:27.214Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xaralis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-04-12T13:39:28.000Z","updated_at":"2024-10-30T16:32:24.000Z","dependencies_parsed_at":"2024-06-18T18:15:55.974Z","dependency_job_id":"28857fac-d6d8-4c78-baaf-c6c9fb56feb3","html_url":"https://github.com/xaralis/django-static-sitemaps","commit_stats":{"total_commits":125,"total_committers":30,"mean_commits":4.166666666666667,"dds":0.536,"last_synced_commit":"b514be87edf07b03f70bd0945615177c7326c2dd"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaralis%2Fdjango-static-sitemaps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaralis%2Fdjango-static-sitemaps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaralis%2Fdjango-static-sitemaps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaralis%2Fdjango-static-sitemaps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xaralis","download_url":"https://codeload.github.com/xaralis/django-static-sitemaps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149501,"owners_count":20891954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T12:21:24.801Z","updated_at":"2025-04-04T09:09:03.823Z","avatar_url":"https://github.com/xaralis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-static-sitemaps\n========================\n\nThere 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**/**celery task** that generates the ``sitemap.xml`` to the separate files.\n\nFeature highlights:\n\n* **NEW:** Compatible with Django 2.0+\n* **NEW:** Python 3 compatible\n* Generate sitemap files to your STATIC/MEDIA/(own choice) directory\n* Split sitemap files when limit for size is reached\n* gzip the sitemap files when required\n* Set different domain for sitemap file\n\nPython 2 users\n------\n\nPython 2 users have should use `4.4.0`. Newer versions will by Python 3 compatible only. Sorry about that.\n\nRequirements\n------------\n\nThe only requirement is Django 1.8+. App should work with older Django versions with some settings\ntweaks.\n\n\nUsage\n------\n\nInstall via standard Python way::\n\n\tpip install django-static-sitemaps\n\nAdd `static_sitemaps` to you ``INSTALLED_APPS`` and make sure\n`django.contrib.sitemaps` is present too:\n\n```python\nINSTALLED_APPS = (\n    ...\n    'django.contrib.sites',\n    'django.contrib.sitemaps',\n    ...\n    'static_sitemaps',\n    ...\n)\n\nSITE_ID = 1\n```\n\nRemember to run `python manage.py makemigrations` and `python manage.py migrate`.\n\nSet ``STATICSITEMAPS_ROOT_SITEMAP`` variable in your ``settings.py`` to point\nto dictionary holding the sitemaps configuration (as seen in Django docs)::\n\n\tSTATICSITEMAPS_ROOT_SITEMAP = 'myproject.sitemaps.sitemaps'\n\nAlso, make sure you have `STATICSITEMAPS_ROOT_DIR` or at least `STATIC_ROOT` configured.\nSitemap files will be placed there.\n\nInclude ``static_sitemaps.urls`` to your ``urls.py`` to serve the root\n``sitemap.xml`` if you want to serve index file through Django (might be\nusefull sometimes when it's hard for you to serve it by webserver itself):\n\n\turlpatterns = [\n\t    path('', include('static_sitemaps.urls')),\n\t]\n\nSetup your cron to run::\n\n\tdjango-admin.py refresh_sitemap\n\nperiodically. Usually, it's enough to set it to run once by 30 minutes or so.\n\nFor Windows users you can alternatively use the following command:\n\n\tpython manage.py runserver\n\nDone.\n\nAlternatively, you can run this using a Celery task runner. For details, look below.\n\n**Note:** Your sitemap files will be served from ``STATIC_URL`` by default. If your\n``STATIC_URL`` is a relative one (e.g. ``/static/``), the result will be\nprepended the domain to respect the current ``Site`` object. If your\n``STATIC_URL`` is absolute (generally doesn't start with a '/'), sitemaps\nURL will respect it completely. If you need more detailed control, see\n``STATICSITEMAPS_URL`` setting.\n\n**Note about sitemap index lastmod:** In the static_sitemaps app the sitemaps\nindex works slightly different than the Django's default behaviour. Just like\nDjango it also gathers all urls from the generated sitemaps but it also\nincludes a new XML tag ``lastmod``. The date/time set in this tag comes\nfrom the first element of the generated file, so reverse sorting your query\nby your date field will keep this information accurate. This is important to\ninform the crawler how fresh is the information inside each sitemap inside the\nsitemap_index.xml.\n\nRunning as celery task\n----------------------\n\nIf you run celery as your task runner, you should be ready to go out of the box. django-static-sitemaps includes the ``GenerateSitemap`` task which will be automatically run each ``STATICSITEMAPS_REFRESH_AFTER`` minutes (defaults to 60 ~ 1 hour). You can optionally bypass it by setting it to ``None``.\n\nAdvanced settings\n------------------\n\n``STATICSITEMAPS_ROOT_DIR``\n    Filesystem path to generate the sitemaps files to. Defaults to ``STATIC_ROOT`` directory.\n\n``STATICSITEMAPS_USE_GZIP``\n\tDefaults to ``True``. If ``True``, gzip compression will be used when generating the sitemaps files (which is very possible by sitemaps specification).\n\n``STATICSITEMAPS_GZIP_METHOD``\n    Gzip method to use. Must be in ['python', 'system', ].\n\n``STATICSITEMAPS_SYSTEM_GZIP_PATH``\n    Path to the gzip binary if use STATICSITEMAPS_GZIP_METHOD == 'system'.\n\n``STATICSITEMAPS_FILENAME_TEMPLATE``\n\tTemplate for sitemap parts. Defaults to ``sitemap-%(section)s-%(page)s.xml``.\n\n``STATICSITEMAPS_INDEX_TEMPLATE``\n    Template path for sitemap index. Defaults to ``static_sitemaps/sitemap_index.xml``.\n\n``STATICSITEMAPS_URL``\n\tSet this to the URL from which you want to serve the sitemaps. Can be an URL with and without domain, e.g. http://example.com/media/sitemaps/ or /media/sitemaps/.\n\tIf no domain is given, the domain of the current Django site is used. Default is STATIC_URL.\n\n``STATICSITEMAPS_LANGUAGE``\n    Language code to use when generating the sitemaps. Defaults to ``LANGUAGE_CODE`` setting.\n\n``STATICSITEMAPS_REFRESH_AFTER``\n    How often (in minutes) should the celery task be run. Defaults to 60 minutes.\n\n``STATICSITEMAPS_MOCK_SITE``\n    True|False setting if you want to mock the Django sites framework. Useful if you want to use package without enabling django.contrib.sites. Defaults to False.\n\n``STATICSITEMAPS_MOCK_SITE_NAME``\n    URL of the site your mocking. This is what will show up in your sitemap as the URL. For example: 'www.yoursite.com'. Defaults to None.\n\n``STATICSITEMAPS_MOCK_SITE_PROTOCOL``\n    Protocol to use when mocking above site name. Defaults to 'http'.\n\n``STATICSITEMAPS_STORAGE``\n    Storage class to use. Defaults to ``django.core.files.storage.FileSystemStorage``.\n\n\nUsing a custom template\n-----------------------\n\nIf you need to use a template different from the Django's default (for example\nto generate a Google News sitemap) you can extend the you Sitemap class and\nsetting a ``sitemap_template`` attribute. For example:\n\n    from django.contrib.sitemaps import GenericSitemap\n\n    class GoogleNewsSitemap(GenericSitemap):\n        sitemap_template = 'sitemap_googlenews.xml'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaralis%2Fdjango-static-sitemaps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxaralis%2Fdjango-static-sitemaps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaralis%2Fdjango-static-sitemaps/lists"}