Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Split Custom Domains as Explanation and How-to Guide (Diátaxis) #9676

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
6b08a64
Diatáxis refactor: Move Custom Domains to the How-to section
benjaoming Oct 19, 2022
35647a8
Proposal: Split up Custom Domains into two articles, no new contents …
benjaoming Oct 20, 2022
620f03a
Try to make "Custom Domain" feature description more self-contained
benjaoming Oct 20, 2022
a8b42e9
Update cross-references to match new location
benjaoming Oct 20, 2022
16baf25
Update docs/user/guides/custom-domains.rst
benjaoming Oct 21, 2022
e702e01
Update docs/user/custom-domains.rst
benjaoming Oct 21, 2022
216f4b5
Update seealso:: box with a better pattern
benjaoming Oct 21, 2022
27795ad
Merge branch 'diataxis/move-custom-domains' of github.com:benjaoming/…
benjaoming Oct 21, 2022
c5ff11b
Remove redundant section label
benjaoming Oct 24, 2022
85994e9
Merge branch 'diataxis/main' of github.com:readthedocs/readthedocs.or…
benjaoming Nov 25, 2022
a071664
Add custom-domains to explanation section, add a "What to consider" s…
benjaoming Nov 25, 2022
9b2a5a4
Replace "central" with "reliable"
benjaoming Nov 25, 2022
e81981e
Remove the example, there's already enough explanation
benjaoming Nov 25, 2022
60b4069
Add mention of canonical domains
benjaoming Nov 25, 2022
d660530
Highlight **canonical** at first apperance, then emphasize its import…
benjaoming Nov 25, 2022
8aac235
Try to simplify explanation and adds CNAME to the equation.
benjaoming Nov 28, 2022
234aaf0
Fix language
benjaoming Nov 28, 2022
42bfb84
Remove "by default"
benjaoming Nov 28, 2022
b40f904
Apply suggestions from code review @ericholscher
benjaoming Nov 28, 2022
33c2e53
Use Dashboard term
benjaoming Nov 29, 2022
f3bf30b
Fix up the canonical domain explanation
benjaoming Nov 29, 2022
13de41b
Change to use :guilabel: in explanation of where to add Custom Domains
benjaoming Nov 30, 2022
19234fe
Try to build an SVG diagram with sphinxcontrib-mermaid and mmdc
benjaoming Dec 1, 2022
df034f5
Start a real diagram, only build with mmdc if in a Read the Docs build
benjaoming Dec 1, 2022
9f1a58f
Disable SVG generation with mermaid-js
benjaoming Dec 1, 2022
133ec92
Swap direction of diagram, add some more icons
benjaoming Dec 1, 2022
778ca17
Also illustrate the build process
benjaoming Dec 1, 2022
e435ab9
Sketching: Move contents of Canonical URLs to Custom Domains explanat…
benjaoming Dec 1, 2022
5e7bd3c
Tweak text, sembr
benjaoming Dec 1, 2022
6b3c7b7
Canonical URLs again in separate article. More cross-references in Cu…
benjaoming Dec 2, 2022
585a115
Make sure to mention cache invalidation for Read the Docs for Business
benjaoming Dec 2, 2022
ea43c43
Replace "See more" with a better caption
benjaoming Dec 2, 2022
ed2bbf6
Merge branch 'diataxis/main' of github.com:readthedocs/readthedocs.or…
benjaoming Dec 6, 2022
21d64b7
Refer using seealso::
benjaoming Dec 6, 2022
2d9c62e
Text tweaks to Canonical URLs explanation
benjaoming Dec 6, 2022
4d0746e
Move How-to content to a separate how-to
benjaoming Dec 6, 2022
3e52416
Updates to the original Canonical URLs how-to sections and further re…
benjaoming Dec 6, 2022
03f68a4
Revert back to previous phrase, it reads better
benjaoming Dec 6, 2022
4dd01d8
Update docs/user/canonical-urls.rst
benjaoming Dec 6, 2022
93953a1
Apply suggestions from code review from @agjohnson and @benjaoming
benjaoming Dec 6, 2022
42e8368
Update docs/user/custom-domains.rst
benjaoming Dec 6, 2022
b2824a1
Apply suggestions from @ericholscher code review
benjaoming Dec 7, 2022
db3ff0d
Downgrade cross-reference from a seealso to normal text re:@ericholsher
benjaoming Dec 7, 2022
20f7349
Add a cautious message to anyone that would want to define html_baseurl.
benjaoming Dec 7, 2022
b3c749c
parenthesis clarified
benjaoming Dec 7, 2022
2ee8508
Add a shortcut convention for referencing issues
benjaoming Dec 7, 2022
2972aa7
Add example code for MkDocs which unfortunately requires a bit of ela…
benjaoming Dec 7, 2022
eea3ec0
Updates diagram and intro text to be easier to digest
benjaoming Dec 7, 2022
5726e8f
Add a bold text that a project needs to be rebuilt. Move the note abo…
benjaoming Dec 7, 2022
30d7d74
Turn support seealso into a note
benjaoming Dec 7, 2022
3ca6b7d
Merge branch 'diataxis/main' of github.com:readthedocs/readthedocs.or…
benjaoming Dec 7, 2022
e8856d3
Apply suggestions from @ericholscher code review
benjaoming Dec 8, 2022
22a7bfe
Convert Mermaid diagram to SVG, remove sphinxcontrib-mermaid
benjaoming Dec 8, 2022
b5a230b
Merge branch 'diataxis/move-custom-domains' of github.com:benjaoming/…
benjaoming Dec 8, 2022
1c14c80
Add a closing backtick, remove image alignment (causes wrong vertical…
benjaoming Dec 8, 2022
ef276b8
Update docs/user/guides/canonical-urls.rst
benjaoming Dec 9, 2022
ba392a7
Manually create a PNG version (not as straight-forward as assumed)
benjaoming Dec 9, 2022
d85055e
Merge branch 'diataxis/move-custom-domains' of github.com:benjaoming/…
benjaoming Dec 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 8 additions & 109 deletions docs/user/custom-domains.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,116 +11,15 @@ By default, your documentation is served from a Read the Docs :ref:`subdomain <h

For example if you import your project and it gets the :term:`slug` ``example-docs``, it will be served from ``https://example-docs.readthedocs.io``.

.. contents:: Contents
:local:
How does it work?
-----------------
benjaoming marked this conversation as resolved.
Show resolved Hide resolved

Adding a custom domain
----------------------
If you own a domain and would like to use it for your documentation, Read the Docs requires only :ref:`a single edit <adding_domain>` to the DNS settings of the domain.
After this, your documentation will be served from your domain and SSL will also be configured automatically.
benjaoming marked this conversation as resolved.
Show resolved Hide resolved

To setup your custom domain, follow these steps:
In case you change your domain name, your documentation can have multiple secondary domains but only one canonical domain name.
Additional domains or subdomains will redirect to the canonical domain.
benjaoming marked this conversation as resolved.
Show resolved Hide resolved

#. Go the :guilabel:`Admin` tab of your project.
#. Click on :guilabel:`Domains`.
#. Enter your domain.
#. Mark the :guilabel:`Canonical` option if you want use this domain
as your :doc:`canonical domain </canonical-urls>`.
#. Click on :guilabel:`Add`.
#. At the top of the next page you'll find the value of the DNS record that you need to point your domain to.
For |org_brand| this is ``readthedocs.io``, and for :doc:`/commercial/index`
the record is in the form of ``<hash>.domains.readthedocs.com``.
.. seealso::

.. note::

For a subdomain like ``docs.example.com`` add a CNAME record,
and for a root domain like ``example.com`` use an ANAME or ALIAS record.

By default, we provide a validated SSL certificate for the domain,
managed by `Cloudflare <https://www.cloudflare.com/>`_.
The SSL certificate issuance should happen within a few minutes,
but might take up to one hour.
See `SSL certificate issue delays`_ for more troubleshooting options.

As an example, our blog's DNS record looks like this:

.. prompt:: bash $, auto

$ dig +short CNAME blog.readthedocs.com
readthedocs.io.

.. warning::

We don't support pointing subdomains or root domains to a project using A records.
DNS A records require a static IP address and our IPs may change without notice.


Removing a custom domain
------------------------

To remove a custom domain:

#. Go the :guilabel:`Admin` tab of your project.
#. Click on :guilabel:`Domains`.
#. Click the :guilabel:`Remove` button next to the domain.
#. Click :guilabel:`Confirm` on the confirmation page.

.. warning::

Once a domain is removed,
your previous documentation domain is no longer served by Read the Docs,
and any request for it will return a 404 Not Found!

Strict Transport Security (HSTS) and other custom headers
---------------------------------------------------------

By default, we do not return a `Strict Transport Security header`_ (HSTS) for user custom domains.
This is a conscious decision as it can be misconfigured in a not easily reversible way.
For both |org_brand| and |com_brand|, HSTS and other custom headers can be set upon request.

We always return the HSTS header with a max-age of at least one year
for our own domains including ``*.readthedocs.io``, ``*.readthedocs-hosted.com``, ``readthedocs.org`` and ``readthedocs.com``.

Please contact :doc:`support` if you want to add a custom header to your domain.

.. _Strict Transport Security header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security

Multiple documentation sites as sub-folders of a domain
-------------------------------------------------------

You may host multiple documentation repositories as **sub-folders of a single domain**.
For example, ``docs.example.org/projects/repo1`` and ``docs.example.org/projects/repo2``.
This is `a way to boost the SEO of your website <https://moz.com/blog/subdomains-vs-subfolders-rel-canonical-vs-301-how-to-structure-links-optimally-for-seo-whiteboard-friday>`_.

See :doc:`subprojects` for more information.

Troubleshooting
---------------

SSL certificate issue delays
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The status of your domain validation and certificate can always be seen on the details page for your domain
under :guilabel:`Admin` > :guilabel:`Domains` > :guilabel:`YOURDOMAIN.TLD (details)`.

Domains are usually validated and a certificate issued within minutes.
However, if you setup the domain in Read the Docs without provisioning the necessary DNS changes
and then update DNS hours or days later,
this can cause a delay in validating because there is an exponential back-off in validation.

.. tip::

Loading the domain details in the Read the Docs dashboard and saving the domain again will force a revalidation.

The validation process period has ended
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

After you add a new custom domain, you have 30 days to complete the configuration.
Once that period has ended, we will stop trying to validate your domain.
If you still want to complete the configuration,
go to your domain and click on :guilabel:`Save` to restart the process.

Migrating from GitBook
~~~~~~~~~~~~~~~~~~~~~~

If your custom domain was previously used in GitBook, contact GitBook support (via live chat in their website)
to remove the domain name from their DNS Zone in order for your domain name to work with Read the Docs,
else it will always redirect to GitBook.
Eager to get started? Have a look at :doc:`/guides/custom-domains`
benjaoming marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions docs/user/guides/administrators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ have a look at our :doc:`/tutorial/index`.
.. toctree::
:maxdepth: 1

Add A Custom Domain <custom-domains>
benjaoming marked this conversation as resolved.
Show resolved Hide resolved
technical-docs-seo-guide
manage-translations-sphinx
advanced-search
Expand Down
121 changes: 121 additions & 0 deletions docs/user/guides/custom-domains.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
How To Manage Custom Domains
============================

In this guide, you will find the simple steps of how to host your documentation from your own domain name, such as ``yourdomain.tld`` or ``docs.yourdomain.tld``.
benjaoming marked this conversation as resolved.
Show resolved Hide resolved

.. contents:: Contents
:local:

.. _adding_domain:
benjaoming marked this conversation as resolved.
Show resolved Hide resolved

Adding a custom domain
----------------------

To setup your :doc:`custom domain </custom-domains>`, follow these steps:

#. Go the :guilabel:`Admin` tab of your project.
#. Click on :guilabel:`Domains`.
#. Enter your domain.
#. Mark the :guilabel:`Canonical` option if you want use this domain
as your :doc:`canonical domain </canonical-urls>`.
#. Click on :guilabel:`Add`.
#. At the top of the next page you'll find the value of the DNS record that you need to point your domain to.
For |org_brand| this is ``readthedocs.io``, and for :doc:`/commercial/index`
the record is in the form of ``<hash>.domains.readthedocs.com``.

.. note::

For a subdomain like ``docs.example.com`` add a CNAME record,
and for a root domain like ``example.com`` use an ANAME or ALIAS record.

By default, we provide a validated SSL certificate for the domain,
benjaoming marked this conversation as resolved.
Show resolved Hide resolved
managed by `Cloudflare <https://www.cloudflare.com/>`_.
The SSL certificate issuance should happen within a few minutes,
but might take up to one hour.
See `SSL certificate issue delays`_ for more troubleshooting options.

As an example, our blog's DNS record looks like this:

.. prompt:: bash $, auto

$ dig +short CNAME blog.readthedocs.com
readthedocs.io.

.. warning::

We don't support pointing subdomains or root domains to a project using A records.
DNS A records require a static IP address and our IPs may change without notice.


Removing a custom domain
------------------------

To remove a custom domain:

#. Go the :guilabel:`Admin` tab of your project.
#. Click on :guilabel:`Domains`.
#. Click the :guilabel:`Remove` button next to the domain.
#. Click :guilabel:`Confirm` on the confirmation page.

.. warning::

Once a domain is removed,
your previous documentation domain is no longer served by Read the Docs,
and any request for it will return a 404 Not Found!

Strict Transport Security (HSTS) and other custom headers
---------------------------------------------------------

By default, we do not return a `Strict Transport Security header`_ (HSTS) for user custom domains.
This is a conscious decision as it can be misconfigured in a not easily reversible way.
For both |org_brand| and |com_brand|, HSTS and other custom headers can be set upon request.

We always return the HSTS header with a max-age of at least one year
for our own domains including ``*.readthedocs.io``, ``*.readthedocs-hosted.com``, ``readthedocs.org`` and ``readthedocs.com``.

Please contact :doc:`/support` if you want to add a custom header to your domain.
benjaoming marked this conversation as resolved.
Show resolved Hide resolved

.. _Strict Transport Security header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security

Multiple documentation sites as sub-folders of a domain
-------------------------------------------------------

You may host multiple documentation repositories as **sub-folders of a single domain**.
For example, ``docs.example.org/projects/repo1`` and ``docs.example.org/projects/repo2``.
This is `a way to boost the SEO of your website <https://moz.com/blog/subdomains-vs-subfolders-rel-canonical-vs-301-how-to-structure-links-optimally-for-seo-whiteboard-friday>`_.

See :doc:`/subprojects` for more information.
benjaoming marked this conversation as resolved.
Show resolved Hide resolved


Troubleshooting
---------------

SSL certificate issue delays
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The status of your domain validation and certificate can always be seen on the details page for your domain
under :guilabel:`Admin` > :guilabel:`Domains` > :guilabel:`YOURDOMAIN.TLD (details)`.

Domains are usually validated and a certificate issued within minutes.
However, if you setup the domain in Read the Docs without provisioning the necessary DNS changes
and then update DNS hours or days later,
this can cause a delay in validating because there is an exponential back-off in validation.

.. tip::

Loading the domain details in the Read the Docs dashboard and saving the domain again will force a revalidation.

The validation process period has ended
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

After you add a new custom domain, you have 30 days to complete the configuration.
Once that period has ended, we will stop trying to validate your domain.
If you still want to complete the configuration,
go to your domain and click on :guilabel:`Save` to restart the process.

Migrating from GitBook
~~~~~~~~~~~~~~~~~~~~~~

If your custom domain was previously used in GitBook, contact GitBook support (via live chat in their website)
to remove the domain name from their DNS Zone in order for your domain name to work with Read the Docs,
else it will always redirect to GitBook.
benjaoming marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions docs/user/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ and how to write successful documentation.
:doc:`More guides for authors </guides/authors>`

* **For project administrators**:
:doc:`Add A Custom Domain </guides/custom-domains>` |
benjaoming marked this conversation as resolved.
Show resolved Hide resolved
:doc:`/guides/technical-docs-seo-guide` |
:doc:`/guides/manage-translations-sphinx` |
:doc:`/guides/advanced-search` |
Expand Down