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

Insert <link rel="canonical"> elements #1140

Merged
merged 1 commit into from
Aug 30, 2023
Merged

Insert <link rel="canonical"> elements #1140

merged 1 commit into from
Aug 30, 2023

Conversation

mgeisler
Copy link
Collaborator

This prevents duplicate search results in case copies of the material is being left visible on the web. See the Search Central documentation for details.

The implementation here is very simple and should go away when google/mdbook-i18n-helpers#70 is implemented.

Copy link
Collaborator

@djmitche djmitche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea that forks of this repo should point to the canonical location? Doing this substitution in the workflow means that someone running mdbook build and uploading it to a test location won't get the substitution.

theme/index.hbs Outdated Show resolved Hide resolved
@mgeisler
Copy link
Collaborator Author

Is the idea that forks of this repo should point to the canonical location? Doing this substitution in the workflow means that someone running mdbook build and uploading it to a test location won't get the substitution.

That is a good point... maybe I should use JavaScript instead then! It's supported, but I got the impression that it's a bit discouraged. But it's important that people get the tags even if they run mdbook build locally, so we should go with that route instead. Thanks!

This prevents duplicate search results in case copies of the material
is being left visible on the web. See

  https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls

for details.

The implementation here should mostly go away when
google/mdbook-i18n-helpers#70 is
implemented.
@mgeisler
Copy link
Collaborator Author

Thanks for catching the problem with putting the logic into publish.yml. I downloaded the tarball for Danish and checked locally that we generate correct canonical URLs now.

@mgeisler mgeisler merged commit 8b1bed7 into main Aug 30, 2023
33 checks passed
@mgeisler mgeisler deleted the canonical-links branch August 30, 2023 20:28
mgeisler added a commit that referenced this pull request Aug 30, 2023
This is a follow-up to #1140 to further ensure that people can find
the canonical home for the course.
mgeisler added a commit that referenced this pull request Aug 31, 2023
This is a follow-up to #1140 to further ensure that people can find the
canonical home for the course.
yohcop pushed a commit to yohcop/comprehensive-rust that referenced this pull request Sep 12, 2023
This prevents duplicate search results in case copies of the material is
being left visible on the web. See the Search Central
documentation[1] for details.

The implementation here should mostly go away when
google/mdbook-i18n-helpers#70 is implemented.

[1]: https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls
yohcop pushed a commit to yohcop/comprehensive-rust that referenced this pull request Sep 12, 2023
This is a follow-up to google#1140 to further ensure that people can find the
canonical home for the course.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants