Skip to content

Commit 0858709

Browse files
authored
Merge pull request #7333 from readthedocs/guide-deprecate-content
Guide: deprecating content
2 parents d0b5611 + 16b5439 commit 0858709

File tree

2 files changed

+116
-15
lines changed

2 files changed

+116
-15
lines changed

docs/guides/deprecating-content.rst

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
Deprecating Content on Read the Docs
2+
====================================
3+
4+
When you deprecate a feature from your project,
5+
you may want to deprecate its docs as well,
6+
and stop your users from reading that content.
7+
8+
Deprecating content may sound as easy as delete it,
9+
but doing that will break existing links,
10+
and you don't necessary want to make the content inaccessible.
11+
Here you'll find some tips on how to use Read the Docs to deprecate your content
12+
progressively and in non harmful ways.
13+
14+
Deprecating versions
15+
--------------------
16+
17+
If you have multiple versions of your project,
18+
it makes sense to have its :doc:`documentation versioned </versions>` as well.
19+
For example, if you have the following versions and want to deprecate v1.
20+
21+
- ``https://project.readthedocs.io/en/v1/``
22+
- ``https://project.readthedocs.io/en/v2/``
23+
- ``https://project.readthedocs.io/en/v3/``
24+
25+
For cases like this you can *hide* a version.
26+
Hidden versions won't be listed in the versions menu of your docs,
27+
and they will be listed in a :ref:`robots.txt file <hosting:custom robots.txt pages>`
28+
to stop search engines of showing results for that version.
29+
30+
Users can still see all versions in the dashboard of your project.
31+
To hide a version go to your project and click on :guilabel:`Versions` > :guilabel:`Edit`,
32+
and mark the :guilabel:`Hidden` option. Check :ref:`versions:Version States` for more information.
33+
34+
.. note::
35+
36+
If the versions of your project follow the semver_ convention,
37+
you can activate the :ref:`versions:version warning` option for your project.
38+
A banner with a warning and linking to the stable version
39+
will be shown on all versions that are lower than the stable one.
40+
41+
.. _semver: https://semver.org/
42+
43+
Deprecating content
44+
-------------------
45+
46+
You may not always want to deprecate a version, but deprecate some pages.
47+
For example, if you have documentation about two APIs and you want to deprecate v1:
48+
49+
- ``https://project.readthedocs.io/en/latest/api/v1.html``
50+
- ``https://project.readthedocs.io/en/latest/api/v2.html``
51+
52+
A simple way is just adding a warning at the top of the page,
53+
this will warn users visiting that page,
54+
but it won't stop users from being redirected to that page from search results.
55+
You can add an entry of that page in a :ref:`custom robots.txt <hosting:custom robots.txt pages>` file
56+
to avoid search engines of showing those results. For example::
57+
58+
# robots.txt
59+
60+
User-agent: *
61+
62+
Disallow: /en/latest/api/v1.html # Deprecated API
63+
64+
But your users will still see search results from that page if they use the search from your docs.
65+
With Read the Docs you can set a :ref:`custom rank per pages <config-file/v2:search.ranking>`.
66+
For example:
67+
68+
.. code-block:: yaml
69+
70+
# .readthedocs.yaml
71+
72+
version: 2
73+
search:
74+
ranking:
75+
api/v1.html: -1
76+
77+
This wont hide results from that page, but it will give priority to results from other pages.
78+
79+
.. TODO: mention search.ignore when it's implemented.
80+
81+
82+
.. tip::
83+
84+
If you are using Sphinx with reStructuredText,
85+
you can make use of some :doc:`directives <sphinx:usage/restructuredtext/directives>`
86+
like ``warning``, ``deprecated``, ``versionchanged`` to warn your users about deprecated content.
87+
88+
Moving and deleting pages
89+
-------------------------
90+
91+
After you have deprecated a feature for a while,
92+
you may want to get rid of its documentation,
93+
that's OK, you don't have to maintain that content forever.
94+
But be aware that users may have links of that page saved,
95+
and it will be frustrating and confusing for them to get a 404.
96+
97+
To solve that problem you can create a redirect to a page with a similar feature/content,
98+
like redirecting to the docs of the v2 of your API when your users visit the deleted docs from v1,
99+
this is a :ref:`page redirect <user-defined-redirects:page redirects>` from ``/api/v1.html`` to ``/api/v2.html``.
100+
See :doc:`/user-defined-redirects`.

docs/guides/platform.rst

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@ Read the Docs Guides
44
These guides will help you customize or tune aspects of Read the Docs.
55

66
.. toctree::
7-
:maxdepth: 1
7+
:maxdepth: 1
88

9-
autobuild-docs-for-pull-requests
10-
build-notifications
11-
build-using-too-many-resources
12-
canonical
13-
conda
14-
environment-variables
15-
feature-flags
16-
google-analytics
17-
hiding-a-version
18-
searching-with-readthedocs
19-
embedding-content
20-
specifying-dependencies
21-
technical-docs-seo-guide
22-
wipe-environment
9+
autobuild-docs-for-pull-requests
10+
build-notifications
11+
build-using-too-many-resources
12+
canonical
13+
conda
14+
deprecating-content
15+
environment-variables
16+
feature-flags
17+
google-analytics
18+
hiding-a-version
19+
searching-with-readthedocs
20+
embedding-content
21+
specifying-dependencies
22+
technical-docs-seo-guide
23+
wipe-environment

0 commit comments

Comments
 (0)