-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a [sphinx.redirects] table to documenteer.toml
This also updates documenteer's own docs to use this feature.
- Loading branch information
1 parent
c7af706
commit 584d15e
Showing
8 changed files
with
90 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### New features | ||
|
||
- Added a [sphinx.redirects] table to `documenteer.toml`. This provides support for configuring page redirects from the TOML configuratin. Redirects are useful if pages move because of a content re-organization. This feature is based on [sphinx-rediraffe](https://github.com/wpilibsuite/sphinxext-rediraffe). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
# See the documenteer.toml for overrides of the Rubin user guide presets | ||
|
||
from documenteer.conf.guide import * | ||
|
||
rediraffe_redirects = { | ||
"pipelines/build-overview.rst": "guides/pipelines/build-overview.rst", | ||
"pipelines/configuration.rst": "guides/pipelines/configuration.rst", | ||
"pipelines/cpp-api-linking.rst": "guides/pipelines/cpp-api-linking.rst", | ||
"pipelines/index.rst": "guides/pipelines/index.rst", | ||
"pipelines/install.rst": "guides/pipelines/install.rst", | ||
"pipelines/package-docs-cli.rst": "guides/pipelines/package-docs-cli.rst", | ||
"pipelines/stack-docs-cli.rst": "guides/pipelines/stack-docs-cli.rst", | ||
} | ||
from documenteer.conf.guide import * # noqa: F403 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
########################################### | ||
Redirecting pages when reorganizing content | ||
########################################### | ||
|
||
As a documentation site grows, its natural for content to need to move. | ||
If pages are moved or renamed, you should create a redirect from the old page path to the new one so that users won't be orphaned by out-of-date links and bookmarks. | ||
Documenteer supports this with the :ref:`guide-sphinx-redirects` table in the :file:`documenteer.toml` configuration file. | ||
|
||
Adding a page redirect in documenteer.toml | ||
========================================== | ||
|
||
As an example, consider the page at :file:`old-page.rst` has moved to :file:`some-dir/new-page.rst`. | ||
To create a redirect from the old page to the new one, add the following to the :file:`documenteer.toml` file: | ||
|
||
.. code-block:: toml | ||
:caption: documenteer.toml | ||
[sphinx.redirects] | ||
"old-page.rst" = "some-dir/new-page.rst" | ||
These paths are relative to the documentation project's root directory (where :file:`conf.py` and :guide:`documenteer.toml` are located) and include the file extension (e.g., :file:`.rst` or :file:`.md`). | ||
|
||
The table accepts an arbitrary number of redirects: | ||
|
||
.. code-block:: toml | ||
:captin: documenteer.toml | ||
[sphinx.redirects] | ||
"old-page.rst" = "some-dir/new-page.rst" | ||
"foo.rst" = "bar.rst" | ||
Redirects for deleted pages | ||
=========================== | ||
|
||
Besides pages that have been moved, you can use this feature for pages that have been deleted. | ||
Choose an existing path that is most relevant to the deleted page and redirect it to the new location. | ||
|
||
.. code-block:: toml | ||
:caption: documenteer.toml | ||
[sphinx.redirects] | ||
"deleted-page.rst" = "index.rst" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters