Promoting the stable version of the documentation using rel=canonical

I was thinking about documentation SEO today. Like many projects, Datasette offers multiple versions of the documentation:

For other projects that do this I've often found myself running a Google search and landing on on older version of their documentation. How best to avoid that?

I started by looking at how Django addresses this. Django uses rel=canonical - so, on this page: they have the following HTML:

<link rel="canonical" href="">

I tend to default to imitating Django, so I decided to see if I could do that for the Datasette documentation...

... and found out it's already solved for me! Read The Docs, the platform I use for the Datasette documentation, already implements exactly this pattern.

So includes the following HTML:

<link rel="canonical" href="" />

Here's their documentation covering this feature. I think you need to have configured a "default version" (though they may set a sensible default for that already) - for my project the page for doing that is the Advanced settings page at

This TIL started life as a Twitter thread.

Created 2022-01-20T15:15:38-08:00 · Edit