Improve SEO and agentic browsing for public pages (#18).
Add per-page titles/meta/Open Graph, semantic landmarks, robots/sitemap/llms.txt, and accessibility fixes so humans and agents can discover and navigate the site reliably.
This commit is contained in:
@@ -18,6 +18,7 @@ from django.http.response import JsonResponse, HttpResponse
|
||||
from django.views.decorators.csrf import csrf_exempt # new
|
||||
from django.contrib.auth import logout, authenticate, login
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.urls import reverse
|
||||
import stripe
|
||||
import logging
|
||||
|
||||
@@ -122,6 +123,55 @@ def useful_links(request):
|
||||
return render(request, "schasite/useful_links.html", {"links": useful_links})
|
||||
|
||||
|
||||
PUBLIC_SITEMAP_ROUTES = (
|
||||
("index2", "weekly", "1.0"),
|
||||
("about_us2", "monthly", "0.8"),
|
||||
("calendar2", "weekly", "0.8"),
|
||||
("dues2", "monthly", "0.9"),
|
||||
("membership_form2", "monthly", "0.9"),
|
||||
("scha_board2", "monthly", "0.7"),
|
||||
("useful_links2", "monthly", "0.6"),
|
||||
("newsletters2", "monthly", "0.5"),
|
||||
)
|
||||
|
||||
|
||||
def robots_txt(request):
|
||||
sitemap_url = request.build_absolute_uri(reverse("sitemap_xml"))
|
||||
return render(
|
||||
request,
|
||||
"schasite/robots.txt",
|
||||
{"sitemap_url": sitemap_url},
|
||||
content_type="text/plain",
|
||||
)
|
||||
|
||||
|
||||
def sitemap_xml(request):
|
||||
urls = [
|
||||
{
|
||||
"loc": request.build_absolute_uri(reverse(name)),
|
||||
"changefreq": changefreq,
|
||||
"priority": priority,
|
||||
}
|
||||
for name, changefreq, priority in PUBLIC_SITEMAP_ROUTES
|
||||
]
|
||||
return render(
|
||||
request,
|
||||
"schasite/sitemap.xml",
|
||||
{"urls": urls},
|
||||
content_type="application/xml",
|
||||
)
|
||||
|
||||
|
||||
def llms_txt(request):
|
||||
site_root = request.build_absolute_uri("/")
|
||||
return render(
|
||||
request,
|
||||
"schasite/llms.txt",
|
||||
{"site_root": site_root},
|
||||
content_type="text/plain; charset=utf-8",
|
||||
)
|
||||
|
||||
|
||||
def index2(request):
|
||||
return render(request, "schasite/index2.html", {})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user