added dynamic sitemap

This commit is contained in:
DerTyp187
2021-11-19 11:35:16 +01:00
parent ca32c61c7f
commit 514303cd61
7 changed files with 37 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ from django.http.response import HttpResponse
from django.shortcuts import render, redirect
from .models import Category, Topic
from analytics.models import View
from django.views.generic.base import TemplateView
def index(req):
view = View(ip=get_client_ip(req), home=True)
@@ -58,6 +59,17 @@ def category(req, category):
def sitemap(req):
topics = Topic.objects.all()
categories = Category.objects.all()
#REPLACE ALL BLANKS WITH %20
context = {
'topics': topics,
'categories': categories
}
return render(req, 'sitemap.xml', context, 'text/xml')
def about(req):
return render(req, "main/about.html")