Skip to content

Commit 75ba6be

Browse files
committed
DOC: add explanation in writing docs
1 parent 3e1be3d commit 75ba6be

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

doc/devel/documenting_mpl.rst

+36
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,42 @@ should ideally be named similar to :file:`imshow_mynewexample.py`.
888888
Miscellaneous
889889
=============
890890

891+
Moving documentation
892+
--------------------
893+
894+
Sometimes it is desirable to move or consolidate documentation. With no
895+
action this will lead to links either going dead (404) or pointing to old
896+
versions of the documentation. Preferable is to make a redirect on the
897+
new page that refers to the old page. This will make the old page, but it
898+
will have an html refresh that immediately redirects the viewer to the new
899+
page.
900+
901+
So, for example we move ``/doc/topic/old_info.rst`` to
902+
``/doc/topic/new_info.rst``. We make remove ``/doc/topic/old_info.rst`` and
903+
in ``/doc/topic/new_info.rst`` we insert a redirect (probably near the
904+
top of the file to make it noticeable)
905+
906+
.. code-block:: rst
907+
908+
.. redirect-from:: /topic/old_info
909+
910+
In the built docs this will yield an html file
911+
``/build/html/topic/old_info.html`` that has a refresh to ``new_info.html``.
912+
If the two files are in different subdirectories:
913+
914+
.. code-block:: rst
915+
916+
.. redirect-from:: /old_topic/old_info2
917+
918+
will yield an html file ``/build/html/old_topic/old_info2.html`` that has a
919+
(relative) refresh to ``../topic/new_info.html``.
920+
921+
Use the full path for this directive, relative to the doc root at
922+
``http://matplotlib.org/stable/``. So ``/old_topic/old_info2`` would be
923+
found by users at ``http://matplotlib.org/stable/old_topic/old_info2``.
924+
Do not use relative links.
925+
926+
891927
Adding animations
892928
-----------------
893929

0 commit comments

Comments
 (0)