You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, search engines don't know which version to show for API
documentation. For example, searching for "ruby string" in Google will
show the documentation for Ruby 2.0
`https://docs.ruby-lang.org/en/2.0.0/String.html` as the top result (for
docs.ruby-lang.org).
The canonical URL link tag will allow us to set the preferred version:
> The canonical URL link tag defines the preferred URL for the current
> document, which helps search engines reduce duplicate content.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/rel#canonical
For example, for the official Ruby documentation we can add the
following to `.rdoc_options`.
```yaml
canonical_root: https://docs.ruby-lang.org/en/master
```
This will add the canonical URL link tag to relevant pages.
0 commit comments