Django で
前提
Python、
python3 -V Python 3.6.2
python3 -m pip list | grep Django Django (1.11.11)
参考
- Three ways to add a robots.txt to your Django project – fredericiana
- One line robots.txt in django
- 初心者にも
分かる!robots.txtの 作り方 - Meta robots noindex/nofollow/noarchiveタグの
使い 方 | 海外SEO情報ブログ
配置方法
参考記事に
ワンライナーで 書く
この記載方法は
from django.conf.urls import url from django.http import HttpResponse urlpatterns = [ url(r'^robots.txt$', lambda r: HttpResponse("User-agent: *\nDisallow: /", content_type="text/plain")), ]
テキストファイル配置して、 テンプレートと して 読み込む
TemplateView
をrobots.txt
を
from django.views.generic import TemplateView urlpatterns = [ # robots.txt url(r'^robots.txt$', (TemplateView.as_view(template_name="robots.txt", content_type='text/plain', )), name="robots.txt"), ]
django-robots を 使用する
django plugin の
過去に、
Cache が
個人的な 考慮点
初心者にも<meta name="robots" content="noindex, nofollow"></meta>
を
Django の 管理画面の metaタグ指定に ついて
Django 自体の 管理画面に ついて
Django の<meta name="robots" content="noindex, nofollow"></meta>
に
<meta name="robots" content="NONE,NOARCHIVE"></meta>
NONE
は、noindex、<wbr>nofollow
をNOARCHIVE
は
検索エンジンに、
Mezzanine - The Best Django CMS の
Wagtail CMS の 管理画面に ついて
Wagail CMS の<meta name="robots" content="noindex, nofollow"></meta>
に
これはbranding_favicon
と<meta name="robots" content="NONE,NOARCHIVE"></meta>
を
- home/templates/wagtailadmin/login.html
{% extends "wagtailadmin/login.html" %} {% block branding_favicon %} <meta name="robots" content="NONE,NOARCHIVE" /> {% endblock %} {% block branding_login %} mutter.monotalk.xyz 管理機能へサインイン {% endblock %}
Django の
以上です。
コメント