Skip to content

Commit d9c8752

Browse files
committed
Merge canonical urls content into custom domains documentation
1 parent b930940 commit d9c8752

File tree

5 files changed

+52
-64
lines changed

5 files changed

+52
-64
lines changed

docs/canonical.rst

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

docs/custom_domains.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,53 @@ You will need to update your CAA records to allow us to issue the certificate.
132132
If your custom domain was previously used in GitBook, contact GitBook support (via live chat in their website)
133133
to remove the domain name from their DNS Zone in order for your domain name to work with Read the Docs,
134134
else it will always redirect to GitBook.
135+
136+
Canonical URLs
137+
--------------
138+
139+
Canonical URLs allow people to have consistent page URLs for domains.
140+
This is mainly useful for search engines,
141+
so that they can send people to the correct page.
142+
143+
Read the Docs uses these in two ways:
144+
145+
* We point all versions of your docs at the "latest" version as canonical
146+
* We point at the user specified canonical URL, generally a custom domain for your docs.
147+
148+
Example
149+
+++++++
150+
151+
Fabric hosts their docs on Read the Docs.
152+
They mostly use their own domain for them ``http://docs.fabfile.org``.
153+
This means that Google will index both ``http://fabric-docs.readthedocs.io`` and
154+
``http://docs.fabfile.org`` for their documentation.
155+
156+
Fabric will want to set ``http://docs.fabfile.org`` as their canonical URL.
157+
This means that when Google indexes ``http://fabric-docs.readthedocs.io``,
158+
it will know that it should really point at ``http://docs.fabfile.org``.
159+
160+
Enabling
161+
++++++++
162+
163+
You can set the canonical URL for your project in the Project Admin page.
164+
Check your :guilabel:`Admin` > :guilabel:`Domains` page for the domains that we know about.
165+
166+
Implementation
167+
++++++++++++++
168+
169+
If you are using :doc:`Sphinx </intro/getting-started-with-sphinx>`,
170+
Read the Docs will set the value of the html_baseurl_ setting (if isn't already set) to your canonical domain.
171+
172+
.. _html_baseurl: https://www.sphinx-doc.org/page/usage/configuration.html#confval-html_baseurl
173+
174+
If you are using :doc:`MkDocs </intro/getting-started-with-mkdocs>`,
175+
you can use the site_url_ setting.
176+
177+
.. _site_url: https://www.mkdocs.org/user-guide/configuration/#site_url
178+
179+
If you look at the source code for documentation built after you set your canonical URL,
180+
you should see a bit of HTML like this:
181+
182+
.. code-block:: html
183+
184+
<link rel="canonical" href="http://docs.fabfile.org/en/2.4/" />

docs/guides/technical-docs-seo-guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ The canonical URL tells search engines where the original version
161161
your documentation is even if you have multiple versions on the internet
162162
(for example, incomplete translations or deprecated versions).
163163

164-
Read the Docs supports :doc:`setting the canonical URL </canonical>`
164+
Read the Docs supports :ref:`setting the canonical URL <custom_domains:Canonical URLs>`
165165
if you are using a :doc:`custom domain </custom_domains>`
166166
under :guilabel:`Admin` > :guilabel:`Domains`
167167
in the Read the Docs dashboard.

docs/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ and some of the core features of Read the Docs.
7777
* **Overview of core features**:
7878
:doc:`Incoming webhooks </webhooks>` |
7979
:doc:`/custom_domains` |
80-
:doc:`/canonical` |
8180
:doc:`/versions` |
8281
:doc:`/downloadable-documentation` |
8382
:doc:`/hosting` |
@@ -110,7 +109,6 @@ and some of the core features of Read the Docs.
110109
/config-file/index
111110
/webhooks
112111
/custom_domains
113-
/canonical
114112
/versions
115113
/downloadable-documentation
116114
/hosting

docs/single_version.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ if pip was set as a "Single Version" project, then links to its documentation wo
2323
``http://pip.readthedocs.io/`` rather than the default ``http://pip.readthedocs.io/en/latest/``.
2424

2525
Documentation at ``/<language>/<default_version>/`` will still be served for backwards compatibility reasons.
26-
However, our usage of :doc:`canonical` should stop these from being indexed by Google.
26+
However, our usage of :ref:`custom_domains:Canonical URLs` should stop these from being indexed by Google.
2727

2828
.. _dashboard: https://readthedocs.org/dashboard/

0 commit comments

Comments
 (0)