diff --git a/app/models.py b/app/models.py index b89fbe8..8f88744 100644 --- a/app/models.py +++ b/app/models.py @@ -72,6 +72,7 @@ class Announcement(models.Model): class Meta: verbose_name = 'Ogłoszenie' verbose_name_plural = 'Ogłoszenia' + ordering = ['-created_at'] class UserManager(BaseUserManager): diff --git a/app/templates/robots.txt b/app/templates/robots.txt new file mode 100644 index 0000000..8ab4774 --- /dev/null +++ b/app/templates/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Disallow: /admin + +Sitemap: https://puchar.lo5.bielsko.pl/sitemap.xml \ No newline at end of file diff --git a/app/templates/sitemap.xml b/app/templates/sitemap.xml new file mode 100644 index 0000000..e7fb187 --- /dev/null +++ b/app/templates/sitemap.xml @@ -0,0 +1,44 @@ + + + + https://puchar.lo5.bielsko.pl + 1.0 + yearly + + + https://puchar.lo5.bielsko.pl/aktualnosci + 0.9 + {{ latest.created_at | date:"Y-m-d" }} + monthly + + + https://puchar.lo5.bielsko.pl/regulamin + 0.8 + never + + + https://puchar.lo5.bielsko.pl/zadania + 0.8 + yearly + + + https://puchar.lo5.bielsko.pl/wyniki + 0.5 + yearly + + + https://puchar.lo5.bielsko.pl/kontakt + 0.7 + never + + + https://puchar.lo5.bielsko.pl/login + 0.6 + never + + + https://puchar.lo5.bielsko.pl/rejestracja + 0.6 + never + + \ No newline at end of file diff --git a/app/urls.py b/app/urls.py index b39a09f..5992f5b 100644 --- a/app/urls.py +++ b/app/urls.py @@ -1,6 +1,6 @@ from django.urls import path -from .views import SignUpView, SubmitStudentsView, UpdateAccountView, ScoresRedirect, HomeView, NewsView, ScoresView, RulesView, TestsView, ContactView +from .views import SignUpView, SubmitStudentsView, UpdateAccountView, ScoresRedirect, HomeView, NewsView, ScoresView, RulesView, TestsView, ContactView, RobotsView, SitemapView urlpatterns = [ path('', HomeView.as_view(), name='home'), @@ -13,5 +13,8 @@ urlpatterns = [ path('rejestracja/', SignUpView.as_view(), name='signup'), path('konto/', UpdateAccountView, name='account'), - path('zgloszenie/', SubmitStudentsView, name='submission') + path('zgloszenie/', SubmitStudentsView, name='submission'), + + path('robots.txt', RobotsView.as_view()), + path('sitemap.xml', SitemapView.as_view()) ] diff --git a/app/views.py b/app/views.py index dc098a9..ab7e4d8 100644 --- a/app/views.py +++ b/app/views.py @@ -144,3 +144,16 @@ class ContactView(TemplateView): extra_context = { 'contact_page': 'is-active' } + + +class RobotsView(TemplateView): + template_name = 'robots.txt' + content_type = 'text/plain' + + +class SitemapView(TemplateView): + template_name = 'sitemap.xml' + content_type = 'text/xml' + extra_context = { + 'latest': Announcement.objects.first() + }