mirror of
https://github.com/DerTyp7/tealcode-django-python.git
synced 2025-10-29 12:32:09 +01:00
added sitemap and robots.txt
This commit is contained in:
@@ -15,9 +15,12 @@ Including another URLconf
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from django.views.generic.base import TemplateView
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('main.urls')),
|
||||
path('analytics/', include('analytics.urls')),
|
||||
path('SDGFOLKJASDNVASDFASDFSLAKDF/', admin.site.urls),
|
||||
path("robots.txt", TemplateView.as_view(template_name="robots.txt", content_type="text/plain")),
|
||||
path("sitemap.xml", TemplateView.as_view(template_name="sitemap.xml", content_type="text/xml")),
|
||||
path('AD/SDGFOLKJASDNVASDFASDFSLAKDF/', admin.site.urls),
|
||||
]
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
<head>
|
||||
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||
<meta name="description" content="TealCode - Your Code Snippet directory - Java, JavaScript, C, C#, C++, Python"/>
|
||||
<link rel="stylesheet" href="{% static 'css/fonts.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'css/base.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'main/css/topic.css' %}">
|
||||
|
||||
4
TealCode/main/templates/robots.txt
Normal file
4
TealCode/main/templates/robots.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
User-Agent: *
|
||||
Disallow: /AD/
|
||||
Disallow: /AD/*
|
||||
Disallow: /AD
|
||||
22
TealCode/main/templates/sitemap.xml
Normal file
22
TealCode/main/templates/sitemap.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/0.9 http://www.sitemaps.org/schemas/0.9/sitemap.xsd">
|
||||
<!--Main Pages-->
|
||||
<url>
|
||||
<loc>https://code.tealfire.de/</loc>
|
||||
<lastmod>2021-11-19T20:00:06+00:00</lastmod>
|
||||
<priority>1.00</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://code.tealfire.de/about/</loc>
|
||||
<lastmod>2021-11-19T20:00:06+00:00</lastmod>
|
||||
<priority>0.70</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://code.tealfire.de/privacy/</loc>
|
||||
<lastmod>2021-11-19T20:00:06+00:00</lastmod>
|
||||
<priority>0.70</priority>
|
||||
</url>
|
||||
<!--Category Pages-->
|
||||
|
||||
<!--Topic Pages-->
|
||||
|
||||
</urlset>
|
||||
@@ -1,3 +1,4 @@
|
||||
from django.http.response import HttpResponse
|
||||
from django.shortcuts import render, redirect
|
||||
from .models import Category, Topic
|
||||
from analytics.models import View
|
||||
@@ -65,10 +66,11 @@ def about(req):
|
||||
def privacy(req):
|
||||
return render(req, "main/privacy.html")
|
||||
|
||||
|
||||
def get_client_ip(req):
|
||||
x_forwarded_for = req.META.get("HTTP_X_FORWARDED_FOR")
|
||||
if x_forwarded_for:
|
||||
ip = x_forwarded_for.split[","][0]
|
||||
else:
|
||||
ip = req.META.get("REMOTE_ADDR")
|
||||
return ip
|
||||
return ip
|
||||
|
||||
Reference in New Issue
Block a user