dynamic /robots.txt
This commit is contained in:
parent
3b73fe78bd
commit
c640d1253e
6 changed files with 18 additions and 11 deletions
|
@ -89,11 +89,17 @@ def opensearch_xml(request):
|
||||||
'application/xml'
|
'application/xml'
|
||||||
)
|
)
|
||||||
|
|
||||||
def robots_txt(request, url):
|
def robots_txt(request):
|
||||||
return HttpResponse(
|
if settings.CONFIG['site'].get('public'):
|
||||||
'User-agent: *\nDisallow:\nSitemap: %s\n' % request.build_absolute_uri('/sitemap.xml'),
|
robots_txt = '''User-agent: *
|
||||||
'text/plain'
|
Disallow:
|
||||||
)
|
Sitemap: {}
|
||||||
|
'''.format(request.build_absolute_uri('/sitemap.xml'))
|
||||||
|
else:
|
||||||
|
robots_txt = '''User-agent: *
|
||||||
|
Disallow: /
|
||||||
|
'''
|
||||||
|
return HttpResponse(robots_txt, 'text/plain')
|
||||||
|
|
||||||
def getPage(request, data):
|
def getPage(request, data):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -1110,6 +1110,7 @@
|
||||||
"https": true,
|
"https": true,
|
||||||
"id": "0xdb",
|
"id": "0xdb",
|
||||||
"name": "0xDB",
|
"name": "0xDB",
|
||||||
|
"public": true,
|
||||||
"sendReferrer": false,
|
"sendReferrer": false,
|
||||||
"url": "0xDB.org"
|
"url": "0xDB.org"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1583,6 +1583,7 @@
|
||||||
"https": true,
|
"https": true,
|
||||||
"id": "indiancinema",
|
"id": "indiancinema",
|
||||||
"name": "Indiancine.ma",
|
"name": "Indiancine.ma",
|
||||||
|
"public": true,
|
||||||
"sendReferrer": true,
|
"sendReferrer": true,
|
||||||
"url": "indiancine.ma"
|
"url": "indiancine.ma"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1063,6 +1063,7 @@
|
||||||
"https": true,
|
"https": true,
|
||||||
"id": "padma",
|
"id": "padma",
|
||||||
"name": "Pad.ma",
|
"name": "Pad.ma",
|
||||||
|
"public": false,
|
||||||
"sendReferrer": true,
|
"sendReferrer": true,
|
||||||
"url": "pad.ma"
|
"url": "pad.ma"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1002,6 +1002,8 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
||||||
"https": false,
|
"https": false,
|
||||||
"id": "pandora",
|
"id": "pandora",
|
||||||
"name": "pan.do/ra",
|
"name": "pan.do/ra",
|
||||||
|
// Set to true to allow search engines to index the site
|
||||||
|
"public": false,
|
||||||
"sendReferrer": true,
|
"sendReferrer": true,
|
||||||
"url": "pandora.local"
|
"url": "pandora.local"
|
||||||
},
|
},
|
||||||
|
|
|
@ -54,10 +54,6 @@ urlpatterns = [
|
||||||
url(r'^texts/$', text.views.text),
|
url(r'^texts/$', text.views.text),
|
||||||
url(r'^texts/(?P<id>.*?)/\d+$', text.views.text),
|
url(r'^texts/(?P<id>.*?)/\d+$', text.views.text),
|
||||||
url(r'^texts/(?P<id>.*?)$', text.views.text),
|
url(r'^texts/(?P<id>.*?)$', text.views.text),
|
||||||
url(r'^robots.txt$', serve_static_file, {
|
|
||||||
'location': os.path.join(settings.STATIC_ROOT, 'robots.txt'),
|
|
||||||
'content_type': 'text/plain'
|
|
||||||
}),
|
|
||||||
url(r'^favicon.ico$', serve_static_file, {
|
url(r'^favicon.ico$', serve_static_file, {
|
||||||
'location': os.path.join(settings.STATIC_ROOT, 'png/icon.16.png'),
|
'location': os.path.join(settings.STATIC_ROOT, 'png/icon.16.png'),
|
||||||
'content_type': 'image/x-icon'
|
'content_type': 'image/x-icon'
|
||||||
|
|
Loading…
Reference in a new issue