parent
dd0c037929
commit
ce95fe6504
@ -61,8 +61,6 @@ INSTALLED_APPS = [
|
|||||||
|
|
||||||
HONEYPOT_FIELD_NAME = "alias_name"
|
HONEYPOT_FIELD_NAME = "alias_name"
|
||||||
|
|
||||||
SITE_ID = 1
|
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
"django.middleware.security.SecurityMiddleware",
|
"django.middleware.security.SecurityMiddleware",
|
||||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||||
|
13
src/agenda_culturel/sitemaps.py
Normal file
13
src/agenda_culturel/sitemaps.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
from django.contrib import sitemaps
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
|
||||||
|
class StaticViewSitemap(sitemaps.Sitemap):
|
||||||
|
priority = 0.5
|
||||||
|
changefreq = "daily"
|
||||||
|
|
||||||
|
def items(self):
|
||||||
|
return ["home", "cette_semaine", "ce_mois_ci", "aujourdhui", "a_venir", "about", "contact"]
|
||||||
|
|
||||||
|
def location(self, item):
|
||||||
|
return reverse(item)
|
@ -4,10 +4,31 @@ from django.contrib import admin
|
|||||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||||
from django.urls import path, include, re_path
|
from django.urls import path, include, re_path
|
||||||
from django.views.i18n import JavaScriptCatalog
|
from django.views.i18n import JavaScriptCatalog
|
||||||
|
from django.contrib.sitemaps.views import sitemap
|
||||||
|
from django.contrib.sitemaps import GenericSitemap
|
||||||
|
from .sitemaps import StaticViewSitemap
|
||||||
|
|
||||||
from .views import *
|
from .views import *
|
||||||
|
|
||||||
|
event_dict = {
|
||||||
|
"queryset": Event.objects.all(),
|
||||||
|
"date_field": "modified_date",
|
||||||
|
}
|
||||||
|
place_dict = {
|
||||||
|
"queryset": Place.objects.all(),
|
||||||
|
}
|
||||||
|
organisation_dict = {
|
||||||
|
"queryset": Organisation.objects.all(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sitemaps = {
|
||||||
|
"static": StaticViewSitemap,
|
||||||
|
"events": GenericSitemap(event_dict, priority=0.7),
|
||||||
|
"places": GenericSitemap(place_dict, priority=0.6),
|
||||||
|
"organisations": GenericSitemap(organisation_dict, priority=0.2),
|
||||||
|
}
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", home, name="home"),
|
path("", home, name="home"),
|
||||||
path("semaine/<int:year>/<int:week>/", week_view, name="week_view"),
|
path("semaine/<int:year>/<int:week>/", week_view, name="week_view"),
|
||||||
@ -178,6 +199,12 @@ urlpatterns = [
|
|||||||
re_path(r'^robots\.txt', include('robots.urls')),
|
re_path(r'^robots\.txt', include('robots.urls')),
|
||||||
path("__debug__/", include("debug_toolbar.urls")),
|
path("__debug__/", include("debug_toolbar.urls")),
|
||||||
path("ckeditor5/", include('django_ckeditor_5.urls')),
|
path("ckeditor5/", include('django_ckeditor_5.urls')),
|
||||||
|
path(
|
||||||
|
"sitemap.xml",
|
||||||
|
sitemap,
|
||||||
|
{"sitemaps": sitemaps},
|
||||||
|
name="django.contrib.sitemaps.views.sitemap",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user