-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Scaladoc: support setting canonical URLs #7834
Conversation
Introduces a new command line flag for Scaladoc to configure a base URL for generation of canonical URLs on all pages. Canonical URLs intend to help search engines to identify the most relevant/recent version of a page when several versions are available. References [Google Support: Consolidate duplicate URLs](https://support.google.com/webmasters/answer/139066?hl=en) [Blog: Google’s Algorithms Can Ignore Rel Canonical When URLs Contain Different Content.](https://www.gsqi.com/marketing-blog/google-ignore-rel-canonical-different-content/) Fixes scala/bug#10640
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- one question
val canonicalLink = if (canonicalSetting.isSetByUser) { | ||
val canonicalUrl = | ||
if (canonicalSetting.value.endsWith("/")) canonicalSetting.value | ||
else canonicalSetting.value + "/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this normalization to end with a "/" always desired?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path to the actual page gets appended, so yes.
https://github.com/scala/scala/pull/7834/files#diff-789c4c9e5fea2476bc65c256a0449572R53
@ennru Is this one ready to go? Can it be backported to |
Yes, this is ready to be merged. If there are not other comments. |
Sorry about the delay, this is fine to merge for the RC cycle. |
Introduces a new command line flag for Scaladoc to configure a base URL for generation of canonical URLs on all pages.
Canonical URLs intend to help search engines to identify the most relevant/recent version of a page when several versions are available.
References
Google Support: Consolidate duplicate URLs
Blog: Google’s Algorithms Can Ignore Rel Canonical When URLs Contain Different Content.
Fixes scala/bug#10640