Skip to content

Commit

Permalink
robots.txt added.
Browse files Browse the repository at this point in the history
  • Loading branch information
AliYmn committed Feb 5, 2017
1 parent 23e879b commit acf8dbe
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion DjangoBlog/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from django.contrib import admin
from blog.views import (HomeListView,PostDetailView,
AboutTemplateView,BlogListView,
ContactView,CategoryView)
ContactView,CategoryView,RobotsView)
from django.conf import settings
from django.views.static import serve
from django.contrib.sitemaps import GenericSitemap
Expand Down Expand Up @@ -48,6 +48,8 @@

url(r'^sitemap_category\.xml$', sitemap,{'sitemaps': {'blog': GenericSitemap(category_dict, priority=0.6)}},
name='django.contrib.sitemaps.views.sitemap'),

url(r'^robots.txt/', RobotsView.as_view(), name="robots"),
url(r'^ckeditor/', include('ckeditor_uploader.urls')),

]
Expand Down
2 changes: 2 additions & 0 deletions blog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,5 @@ def get_context_data(self, **kwargs):
context['category_post'] = Category.objects.all().filter(title=self.kwargs['slug'])
return context

class RobotsView(TemplateView):
template_name = 'robots.html'
15 changes: 15 additions & 0 deletions templates/robots.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
User-agent: *
<br>
Disallow: /admin/
<br>
Disallow: /*ref=*
<br>
Disallow: /*?ref=*
<br>
Disallow: /?ref=*
<br>
Disallow: *?replytocom
<br>
Sitemap: http://aliyaman.org/sitemap_post.xml
<br>
Sitemap: http://aliyaman.org/sitemap_category.xml

0 comments on commit acf8dbe

Please sign in to comment.