Ajout sitemap + meta description pour accueil

This commit is contained in:
Claude Paroz 2025-11-02 22:51:30 +01:00
parent 9cc4a380d0
commit 6a6ef5612f
5 changed files with 33 additions and 0 deletions

14
beesgospel/sitemaps.py Normal file
View file

@ -0,0 +1,14 @@
from django.contrib import sitemaps
from django.urls import reverse
class StaticViewSitemap(sitemaps.Sitemap):
priority = 0.5
changefreq = "weekly"
def items(self):
return ["home", "presentation", "contact", "agenda"]
def location(self, item):
import pdb; pdb.set_trace()
return reverse(item)

View file

@ -27,6 +27,7 @@ INSTALLED_APPS = [
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sitemaps",
"beesgospel",
]

View file

@ -1,9 +1,15 @@
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
from django.urls import include, path
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
from beesgospel import views
from beesgospel.sitemaps import StaticViewSitemap
sitemaps = {
"static": StaticViewSitemap,
}
urlpatterns = [
path("manifest.json",
@ -29,4 +35,9 @@ urlpatterns = [
path("membres/documents/", views.MediaView.as_view(prive=True), name="docs-membres"),
path("media/chants/<path:path>", views.MediaServeView.as_view(subdir="chants")),
path(
"sitemap.xml", sitemap, {"sitemaps": sitemaps},
name="django.contrib.sitemaps.views.sitemap",
),
]

View file

@ -1,8 +1,10 @@
<!doctype html>
<html lang="fr">
<head>
{% block meta %}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% endblock %}
<title>Le Gospel de lAbeille - Bee's Gospel{% block page_title %}{% endblock %}</title>
<link href="{% static 'vendor/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'css/main.css' %}" rel="stylesheet">

View file

@ -1,5 +1,10 @@
{% extends "base.html" %}
{% block meta %}
{{ block.super }}
<meta name="description" content="Page daccueil du site Web de la chorale du Gospel de lAbeille, La Chaux-de-Fonds, Suisse">
{% endblock %}
{% block bodyclass %}home{% endblock %}
{% block navbar-expand %}{% endblock %}