Skip to content

Add canonical links to new website#97

Open
Marcono1234 wants to merge 2 commits into
joel-costigliola:gh-pagesfrom
Marcono1234:canonical-links
Open

Add canonical links to new website#97
Marcono1234 wants to merge 2 commits into
joel-costigliola:gh-pagesfrom
Marcono1234:canonical-links

Conversation

@Marcono1234

Copy link
Copy Markdown

This hopefully makes search engines prefer the new site, see https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls

At least for me Google and Ecosia still return the old site as one of the first search results.

I have only added the canonical link to the pages which exist on the new site for now.

Note

I am not that familiar with how canonical links work, whether using them here is the best approach and whether this might have undesired side effects. So feel free to reject this pull request if you don't think it is worth it.

Follow-up for bbb71e0
Otherwise running `generate-html.py` will overwrite those changes.
This hopefully makes search engines prefer the new site.
Comment thread generate-html.py
if file_name.startswith("assertj-core") or file_name.startswith("assertj-news"):
return "https://assertj.github.io/doc/"
if file_name.startswith("assertj-db"):
return "https://assertj.github.io/doc/#assertj-db"

@Marcono1234 Marcono1234 Feb 17, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not sure if using a URL fragment (e.g. #assertj-db here) has any / the desired effect here.
https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls says:

Don't specify a URL fragment as canonical

(not sure if that refers to a fragment relative to the current page, or fragments in general)

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.

1 participant