how to add robots.txt to wagtail?

1,374 views
Skip to first unread message

Thierry Durand

unread,
Oct 22, 2015, 2:46:04 AM10/22/15
to Wagtail support
Hi,

where to place robots.txt and do make it seen by google?

thanks & regards.


Thierry

Matthew Westcott

unread,
Oct 22, 2015, 11:33:35 AM10/22/15
to wag...@googlegroups.com
Hi Thierry,

I usually put robots.txt in my app's static folder, and configure nginx to serve it using a setting like:

location /robots.txt {
root /path/to/static;
}

Cheers
- Matt
Message has been deleted

Jordi J.

unread,
Oct 22, 2015, 11:17:06 PM10/22/15
to Wagtail support
Alternatively you can create it under your templates folder and set it on your urls.py file:

url(r'^robots\.txt', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')

Thierry Durand

unread,
Oct 23, 2015, 10:52:03 AM10/23/15
to Wagtail support
thanks guys, i've added it in the nginx setup, same for sitemap.xml

regards.

Matt Davies

unread,
Oct 27, 2015, 8:22:42 AM10/27/15
to Wagtail support
We're looking into this issue at the moment, our production and staging sites have a need for different setups in robot.txt.

We're looking into solutions at the moment, using different urls.py files for staging and production, etc etc.

I found this online.


I'd much prefer to hand over the management of the robots.txt to our content editors.

Does anyone know if that app will work with current wagtail?

Notice it's dependent on South.

Any tips, greatly appreciated.
Reply all
Reply to author
Forward
0 new messages