@@ -132,3 +132,53 @@ You will need to update your CAA records to allow us to issue the certificate.
132
132
If your custom domain was previously used in GitBook, contact GitBook support (via live chat in their website)
133
133
to remove the domain name from their DNS Zone in order for your domain name to work with Read the Docs,
134
134
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/" />
0 commit comments