Skip to content

Commit 739fd3b

Browse files
Docs: Relabel and reorganize hosting features as reference (Diátaxis) (#9952)
* Updated reference for hosting features, adding more features and re-organizing content * Apply suggestions from code review @ericholscher Co-authored-by: Eric Holscher <[email protected]> * Update name of Feature reference index to avoid explicit labels elsewhere * Fix misalignments * Redo in-page references * Update "read more" link for "multiple documentation versions" * Add "private documentation" to hosting feature list * Revert to old title, modify introduction with less passive voice * Dot the list sentences, don't say "bust" but "invalidate and refresh" * Refactor of feature section * Initial refactor of features into dedicated pages. Ended up writing a bunch of additional content here, since these features were barely documented... This will be a big win for our users. * More refactoring * Remove redundancy * Remove stray Makefile commit * Make a mention of this "404/index.html" structure in relation to Sphinx DirHTML builder. * Apply suggestions from code review Co-authored-by: Benjamin Balder Bach <[email protected]> * Lint * Fix typo --------- Co-authored-by: Eric Holscher <[email protected]> Co-authored-by: Eric Holscher <[email protected]>
1 parent 699cc58 commit 739fd3b

File tree

7 files changed

+240
-135
lines changed

7 files changed

+240
-135
lines changed

docs/user/hosting.rst

Lines changed: 0 additions & 130 deletions
This file was deleted.

docs/user/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ and some of the core features of Read the Docs.
128128
:doc:`/custom-domains` |
129129
:doc:`/versions` |
130130
:doc:`/downloadable-documentation` |
131-
:doc:`/hosting` |
132131
:doc:`/server-side-search/index` |
133132
:doc:`/analytics` |
134133
:doc:`/pull-requests` |
@@ -159,7 +158,6 @@ and some of the core features of Read the Docs.
159158
/config-file/index
160159
/integrations
161160
/versions
162-
/hosting
163161

164162
/builds
165163
/build-customization

docs/user/reference/404-not-found.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
``404 Not Found`` pages
2+
=======================
3+
4+
If you want your project to use a custom or branded ``404 Not Found`` page,
5+
you can put a ``404.html`` or ``404/index.html`` at the top level of your project's HTML output.
6+
7+
How it works
8+
------------
9+
10+
When our servers return a ``404 Not Found`` error,
11+
we check if there is a ``404.html`` or ``404/index.html`` in the root of your project's output.
12+
13+
The following locations are checked, in order:
14+
15+
* ``/404.html`` or ``404/index.html`` in the *current* documentation version.
16+
* ``/404.html`` or ``404/index.html`` in the *default* documentation version.
17+
18+
Tool integration
19+
----------------
20+
21+
Documentation tools will have different ways of generating a ``404.html`` or ``404/index.html`` file.
22+
We have examples for some of the most popular tools below.
23+
24+
.. tabs::
25+
26+
.. tab:: Sphinx
27+
28+
We recommend the `sphinx-notfound-page`_ extension,
29+
which Read the Docs maintains.
30+
It automatically creates a ``404.html`` page for your documentation,
31+
matching the theme of your project.
32+
See its documentation_ for how to install and customize it.
33+
34+
If you want to create a custom ``404.html``,
35+
Sphinx uses `html_extra_path`_ option to add static files to the output.
36+
You need to create a ``404.html`` file and put it under the path defined in ``html_extra_path``.
37+
38+
If you are using the ``DirHTML`` builder,
39+
no further steps are required.
40+
Sphinx will automatically apply the ``<page-name>/index.html`` folder structure to your 404 page:
41+
``404/index.html``.
42+
Read the Docs also detects 404 pages named this way.
43+
44+
.. tab:: MkDocs
45+
46+
MkDocs automatically generates a ``404.html`` which Read the Docs will use.
47+
However, assets will not be loaded correctly unless you define the `site_url`_ configuration value as your site's
48+
:ref:`canonical base URL <canonical-urls:MkDocs>`.
49+
50+
.. _sphinx-notfound-page: https://pypi.org/project/sphinx-notfound-page
51+
.. _html_extra_path: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_extra_path
52+
.. _documentation: https://sphinx-notfound-page.readthedocs.io/
53+
.. _site_url: https://www.mkdocs.org/user-guide/configuration/#site_url

docs/user/reference/cdn.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Content Delivery Network (CDN) and caching
2+
==========================================
3+
4+
A CDN is used for making documentation pages *fast* for your users.
5+
CDNs increase speed by caching documentation content in multiple data centers around the world,
6+
and then serving docs from the data center closest to the user.
7+
8+
We support CDNs on both of our sites:
9+
10+
* On |org_brand|,
11+
we are able to provide a CDN to all the projects that we host.
12+
This service is graciously sponsored by `Cloudflare`_.
13+
* On |com_brand|,
14+
the CDN is included as part of our all of our plans.
15+
We use `Cloudflare`_ for this as well.
16+
17+
CDN Benefits
18+
------------
19+
20+
Having a CDN in front of your documentation has many benefits:
21+
22+
* **Improved reliability**: Since docs are served from multiple places, one can go down and the docs are still accessible.
23+
* **Improved performance**: Data takes time to travel across space, so connecting to a server closer to the user makes documentation load faster.
24+
25+
Automatic cache refresh
26+
-----------------------
27+
28+
We automatically refresh the cache on the CDN when the following actions happen:
29+
30+
* Your project is saved.
31+
* Your domain is saved.
32+
* A new version of your documentation is built.
33+
34+
By refreshing the cache according to these rules,
35+
readers should **never see outdated content**.
36+
This makes the end-user experience seamless, and fast.
37+
38+
.. _Cloudflare: https://www.cloudflare.com/

docs/user/reference/features.rst

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,56 @@
1-
========
2-
Features
3-
========
1+
=================
2+
Feature reference
3+
=================
44

5+
.. TODO: Continue to add more features here.
6+
7+
Hosting features
8+
----------------
9+
10+
⏩️ :doc:`/custom-domains`
11+
Documentation projects can use their own domain name.
12+
A project may define multiple domains,
13+
as well as define the *canonical domain* where all other domains will redirect.
14+
15+
16+
⏩️ :doc:`/versions`
17+
We support multiple versions and translations,
18+
integrated nicely into the URL of your documentation.
19+
This is served at ``/en/latest/`` by default.
20+
If you only have 1 version and translation,
21+
we also support :doc:`single version projects </single_version>` served at ``/``.
22+
23+
24+
⏩️ :doc:`/user-defined-redirects`
25+
Projects may define their own custom URL redirects,
26+
with advanced functionality like folder redirects.
27+
28+
⏩️ :doc:`/reference/cdn`
29+
Documentation projects are primarily static HTML pages along with media files.
30+
This allows us to cache them with our CDN,
31+
making them *load faster* for your users.
32+
33+
34+
⏩️ :doc:`/reference/sitemaps`
35+
Sitemaps are generated and hosted automatically,
36+
improving search engine optimization.
37+
This helps your users find content more effectively on your site.
38+
39+
40+
⏩️ :doc:`/reference/404-not-found`
41+
A 404 page is served when we can't find a page on your site.
42+
We provide a default 404 page,
43+
but you can also customize it.
44+
45+
46+
⏩️ :doc:`/reference/robots`
47+
`robots.txt` files allow you to customize how your documentation is indexed in search engines.
48+
We provide a default robots.txt file,
49+
but you can also customize it.
50+
51+
52+
⏩️ :doc:`/commercial/sharing`
53+
It is possible to host private and password protected documentation on Read the Docs for Business.
554

655
.. The TOC here will be refactored once we reorganize the files in docs/user/.
756
.. Probably, all feature reference should be in this directory!
@@ -20,6 +69,10 @@ Features
2069
/automation-rules
2170
/user-defined-redirects
2271
/badges
72+
/reference/cdn
73+
/reference/404-not-found
74+
/reference/robots
75+
/reference/sitemaps
2376
/security-log
2477
/commercial/organizations
2578
/commercial/privacy-level

docs/user/reference/robots.rst

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
``robots.txt`` support
2+
======================
3+
4+
The `robots.txt`_ files allow you to customize how your documentation is indexed in search engines.
5+
It's useful for:
6+
7+
* Hiding various pages from search engines
8+
* Disabling certain web crawlers from accessing your documentation
9+
* Disallowing any indexing of your documentation
10+
11+
Read the Docs automatically generates one for you with a configuration that works for most projects.
12+
By default, the automatically created ``robots.txt``:
13+
14+
* Hides versions which are set to :ref:`versions:Hidden` from being indexed.
15+
* Allows indexing of all other versions.
16+
17+
.. warning::
18+
19+
``robots.txt`` files are respected by most search engines,
20+
but they aren't a guarantee that your pages will not be indexed.
21+
Search engines may choose to ignore your ``robots.txt`` file,
22+
and index your docs anyway.
23+
24+
If you require *private* documentation, please see :doc:`/commercial/sharing`.
25+
26+
How it works
27+
------------
28+
29+
You can customize this file to add more rules to it.
30+
The ``robots.txt`` file will be served from the **default version** of your project.
31+
This is because the ``robots.txt`` file is served at the top-level of your domain,
32+
so we must choose a version to find the file in.
33+
The **default version** is the best place to look for it.
34+
35+
Tool integration
36+
----------------
37+
38+
Documentation tools will have different ways of generating a ``robots.txt`` file.
39+
We have examples for some of the most popular tools below.
40+
41+
.. tabs::
42+
43+
.. tab:: Sphinx
44+
45+
Sphinx uses the `html_extra_path`_ configuration value to add static files to its final HTML output.
46+
You need to create a ``robots.txt`` file and put it under the path defined in ``html_extra_path``.
47+
48+
.. tab:: MkDocs
49+
50+
MkDocs needs the ``robots.txt`` to be at the directory defined by the `docs_dir`_ configuration value.
51+
52+
.. _robots.txt: https://developers.google.com/search/reference/robots_txt
53+
.. _html_extra_path: https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_extra_path
54+
.. _docs_dir: https://www.mkdocs.org/user-guide/configuration/#docs_dir
55+
56+
.. seealso::
57+
58+
:doc:`/guides/technical-docs-seo-guide`

0 commit comments

Comments
 (0)