Skip to content

Commit 034cae1

Browse files
committed
FAQ documentation for robots.txt file
1 parent ef18d92 commit 034cae1

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

docs/faq.rst

+46
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,49 @@ What commit of Read the Docs is in production?
230230
----------------------------------------------
231231

232232
We deploy readthedocs.org from the `rel` branch in our GitHub repository. You can see the latest commits that have been deployed by looking on GitHub: https://github.com/rtfd/readthedocs.org/commits/rel
233+
234+
235+
How can I avoid bot crawlers to show a deprecated version of my docs?
236+
---------------------------------------------------------------------
237+
238+
If readers search something related to your docs in Google, it will probably return the most relevant version of your documentation.
239+
It may happen that this version is already deprecated and you want to stop Google indexing it as a result,
240+
and start suggesting the latest (or newer) one.
241+
242+
To accomplish this, you can add a ``robots.txt`` file to your documentation's root so it ends up served at the root URL of your project
243+
(for example, https://yourproject.readthedocs.io/robots.txt).
244+
245+
246+
Minimal example of ``robots.txt``
247+
+++++++++++++++++++++++++++++++++
248+
249+
::
250+
251+
User-agent: *
252+
Disallow: /en/deprecated-version/
253+
Disallow: /en/2.0/
254+
255+
.. note::
256+
257+
See `Google's docs`_ for its full syntax.
258+
259+
This file has to be served as is under ``/robots.txt``.
260+
Depending if you are using Sphinx or MkDocs, you will need a different configuration for this.
261+
262+
263+
Sphinx
264+
~~~~~~
265+
266+
Sphinx uses `html_extra`_ option to add static files to the output.
267+
You need to create a ``robots.txt`` file and put it under the path defined in ``html_extra``.
268+
269+
270+
MkDocs
271+
~~~~~~
272+
273+
MkDocs needs the ``robots.txt`` to be at the directory defined at `docs_dir`_ config.
274+
275+
276+
.. _Google's docs: https://support.google.com/webmasters/answer/6062608
277+
.. _html_extra: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_extra_path
278+
.. _docs_dir: https://www.mkdocs.org/user-guide/configuration/#docs_dir

0 commit comments

Comments
 (0)