Skip to content

Commit a92b58c

Browse files
benjaominghumitosericholscher
authored
Docs: Split Subprojects in Explanation and How-to (Diátaxis) (#9785)
* Existing text refactored into howto and explanation * Improve subproject explanation with some cases of when it's useful * Apply suggestions from code review by @humitos Co-authored-by: Manuel Kaufmann <[email protected]> * Really spell out the alias of a subproject vs. its name * Lowercase foo and bar * Describe common searching as a main objective of using subprojects, add a subsection about Separate release cycles * Update docs/user/subprojects.rst Co-authored-by: Eric Holscher <[email protected]> * Apply suggestions from code review @ericholscher Co-authored-by: Eric Holscher <[email protected]> * Update docs/user/guides/subprojects.rst * Updates to Subprojects Explanation and How-to from @ericholscher feedback * Update introduction, improvents pending... * Adds another intro paragraph * Also make *main website* emphasized * Update docs/user/guides/subprojects.rst Co-authored-by: Eric Holscher <[email protected]> * Update docs/user/guides/subprojects.rst Co-authored-by: Eric Holscher <[email protected]> * Apply suggestions from code review @ericholscher Co-authored-by: Eric Holscher <[email protected]> * Add mentions of subprojects in Intersphinx how-to and vice versa * Thanks PyCharm for the lovely emoji support 📝️📝️📝️ * Make it possible to see from the main example that example-project-plugin has a short alias * Rename all occurrences of foo and bar to example-project and example-project-plugin * Add precision to subproject create/edit form * Apply suggestions from code review by @humitos 🎉 👍 Co-authored-by: Manuel Kaufmann <[email protected]> * Update docs/user/subprojects.rst Co-authored-by: Manuel Kaufmann <[email protected]> Co-authored-by: Eric Holscher <[email protected]>
1 parent ff8bd8e commit a92b58c

File tree

6 files changed

+131
-27
lines changed

6 files changed

+131
-27
lines changed

docs/user/guides/administrators.rst

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ have a look at our :doc:`/tutorial/index`.
2222
pdf-non-ascii-languages
2323
importing-private-repositories
2424
Setup Build Notifications <build-notifications>
25+
subprojects
2526
Configure Pull Request Builds <pull-requests>
2627
setup-single-sign-on-github-gitlab-bitbucket
2728
setup-single-sign-on-google-email

docs/user/guides/intersphinx.rst

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ While you could just hyperlink directly, there is a better way.
1414
That is, you could use the ``:ref:`` role to link to sections of other documentation projects.
1515
Sphinx will ensure that your cross-references to the other project exist and will raise a warning if they are deleted or changed so you can keep your docs up to date.
1616

17+
If you are publishing several Sphinx projects together using Read the Docs' *subprojects* (see :doc:`/subprojects`),
18+
you should use Intersphinx to reference your subprojects from other projects.
19+
1720
.. note::
1821

1922
You can also use Sphinx's ``linkcheck`` builder to check for broken links.
@@ -48,6 +51,10 @@ And use the ``intersphinx_mapping`` configuration to indicate the name and link
4851
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
4952
}
5053
54+
.. note::
55+
56+
If you are using Read the Docs' subprojects, you also need to enable the Intersphinx extension on each of the subprojects.
57+
For each subproject, you need to add the main project and all the other subprojects to ``intersphinx_mapping``.
5158

5259
Now you can use the ``sphinx`` name with a cross-reference role:
5360

docs/user/guides/subprojects.rst

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
How to manage subprojects
2+
=========================
3+
4+
This guide shows you how to manage subprojects,
5+
which is a way to host multiple projects under a "main project".
6+
7+
.. seealso::
8+
9+
:doc:`/subprojects`
10+
Read more about what the subproject feature can do and how it works.
11+
12+
Adding a subproject
13+
-------------------
14+
15+
In the admin dashboard for your project, select :guilabel:`Subprojects` from the left menu.
16+
From this page you can add a subproject by choosing a project from the :guilabel:`Subproject` dropdown
17+
and typing an alias in the :guilabel:`Alias` field.
18+
19+
Immediately after adding the subproject, it will be hosted at the URL displayed in the updated list of subprojects.
20+
21+
.. image:: /img/screenshot_subprojects_list.png
22+
:alt: Screenshot of a subproject immediately visible in the list after creation
23+
24+
25+
.. note::
26+
27+
|org_brand|
28+
You need to be *maintainer* of a subproject in order to choose it from your main project.
29+
30+
|com_brand|
31+
You need to have *admin access* to the subproject in order to choose it from your main project.
32+
33+
34+
Editing a subproject
35+
--------------------
36+
37+
You can edit a subproject at any time by clicking :guilabel:`📝️` in the list of subprojects.
38+
On the following page, it's possible to both change the subproject and its alias
39+
using the :guilabel:`Subproject` dropdown and the :guilabel:`Alias` field.
40+
Click :guilabel:`Update subproject` to save your changes.
41+
42+
The documentations served at ``/projects/<subproject-alias>/`` will be updated immediately when you save your changes.
43+
44+
45+
Deleting a subproject
46+
---------------------
47+
48+
You can delete a subproject at any time by clicking :guilabel:`📝️` in the list of subprojects.
49+
On the edit page, click :guilabel:`Delete subproject`.
50+
51+
Your subproject will be removed immediately and will be served from it's own domain:
52+
53+
* Previously it was served at: `<main-project-domain>/projects/<subproject-alias>/`
54+
* Now it will be served at `<subproject-domain>/`
55+
56+
**Deleting a subproject only removes the reference from the main project.**
57+
It does not completely remove that project.
262 KB
Loading

docs/user/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ to help you create fantastic documentation for your project.
8282
/custom-domains
8383
/pull-requests
8484
/downloadable-documentation
85+
/subprojects
8586
/single_version
8687
/science
8788

@@ -232,7 +233,6 @@ out of your documentation and Read the Docs.
232233
:glob:
233234
:caption: Advanced features
234235

235-
subprojects
236236
flyout-menu
237237
feature-flags
238238

docs/user/subprojects.rst

+65-26
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,66 @@
1-
Subprojects
2-
===========
1+
Subprojects: host multiple projects on a single domain
2+
======================================================
33

4-
Projects can be configured in a nested manner, by configuring a project as a
5-
*subproject* of another project. This allows for documentation projects to share
6-
a search index and a namespace or custom domain, but still be maintained
7-
independently.
4+
In this article, you can learn more about how several documentation projects can be combined and presented to the reader on the same website.
85

9-
For example, a parent project, ``Foo`` is set up with a subproject, ``Bar``. The
10-
documentation for ``Foo`` will be available at:
6+
Read the Docs can be configured to make other *projects* available on the website of the *main project* as **subprojects**.
7+
This allows for documentation projects to share a search index and a namespace or custom domain,
8+
but still be maintained independently.
119

12-
https://foo.readthedocs.io/en/latest/
10+
This is useful for:
1311

14-
The documentation for ``Bar`` will be available under this same path:
12+
* Organizations that need all their projects visible in one documentation portal or landing page
13+
* Projects that document and release several packages or extensions
14+
* Organizations or projects that want to have a common search function for several sets of documentation
1515

16-
https://foo.readthedocs.io/projects/bar/en/latest/
16+
For a main project ``example-project``, a subproject ``example-project-plugin`` can be made available as follows:
1717

18-
Adding a subproject
19-
-------------------
18+
* Main project: https://example-project.readthedocs.io/en/latest/
19+
* Subproject: https://example-project.readthedocs.io/projects/plugin/en/latest/
2020

21-
In the admin dashboard for your project, select "Subprojects" from the menu.
22-
From this page you can add a subproject by typing in the project slug.
21+
.. seealso::
2322

24-
Subproject aliases
25-
~~~~~~~~~~~~~~~~~~
23+
:doc:`/guides/subprojects`
24+
Learn how to create and manage subprojects
25+
26+
:doc:`/guides/intersphinx`
27+
Learn how to use references between different Sphinx projects, for instance between subprojects
2628

27-
You can use an alias for the subproject when it is created. This allows you to override the URL that is used to access it, giving more configurability to how you want to structure your projects.
2829

2930
Sharing a custom domain
3031
-----------------------
3132

32-
Projects and subprojects can also be used to share a custom domain with a number
33-
of projects. To configure this, one project should be established as the parent
34-
project. This project will be configured with a custom domain. Projects can then
35-
be added as subprojects to this parent project.
33+
Projects and subprojects can be used to share a custom domain.
34+
To configure this, one project should be established as the main project and configured with a custom domain.
35+
Other projects are then added as subprojects to the main project.
36+
37+
If the example project ``example-project`` was set up with a custom domain,
38+
``docs.example.com``, the URLs for projects ``example-project`` and ``example-project-plugin`` with alias ``plugin`` would
39+
respectively be at:
40+
41+
* ``example-project``: https://docs.example.com/en/latest/
42+
* ``example-project-plugin``: https://docs.example.com/projects/plugin/en/latest/
43+
44+
Using aliases
45+
-------------
46+
47+
Adding an alias for the subproject allows you to override the URL that is used to access it,
48+
giving more control over how you want to structure your projects.
49+
You can choose an alias for the subproject when it is created.
50+
51+
You can set your subproject's project name and :term:`slug` however you want,
52+
but we suggest prefixing it with the name of the main project.
3653

37-
If the example project ``Foo`` was set up with a custom domain,
38-
``docs.example.com``, the URLs for projects ``Foo`` and ``Bar`` would
39-
respectively be at: https://docs.example.com/en/latest/ and
40-
https://docs.example.com/projects/bar/en/latest/
54+
Typically, a subproject is created with a ``<mainproject>-`` prefix,
55+
for instance if the main project is called ``example-project`` and the subproject is called ``plugin``,
56+
then the subproject's Read the Docs project :term:`slug` will be ``example-project-plugin``.
57+
When adding the subproject,
58+
the alias is set to ``plugin`` and the project's URL becomes
59+
``example-project.readthedocs.io/projects/plugin``.
60+
61+
When you add a subproject,
62+
the subproject will not be directly available anymore from its own domain.
63+
For instance, ``example-project-plugin.readthedocs.io/`` will redirect to ``example-project.readthedocs.io/projects/plugin``.
4164

4265
Custom domain on subprojects
4366
----------------------------
@@ -46,6 +69,22 @@ Adding a custom domain to a subproject is not allowed,
4669
since your documentation will always be served from
4770
the domain of the parent project.
4871

72+
Separate release cycles
73+
-----------------------
74+
75+
By using subprojects,
76+
you can present the documentation of several projects
77+
even though they have separate release cycles.
78+
79+
Your main project may have its own versions and releases,
80+
while all of its subprojects maintain their own individual versions and releases.
81+
We recommend that documentation follows the release cycle of whatever it is documenting,
82+
meaning that your subprojects should be free to follow their own release cycle.
83+
84+
This is solved by having an individual :term:`flyout menu` active for the project that's viewed.
85+
When the user navigates to a subproject,
86+
they are presented with a flyout menu matching the subproject's versions and :doc:`/downloadable-documentation`.
87+
4988
Search
5089
------
5190

0 commit comments

Comments
 (0)