WordPress, rel canonical missing

We’ve got a site with WP SEO and WPML that we needed <link rel="canonical" /> on but we couldn’t get it to output no matter what we tried.

First, we actually usually disable that tag on most sites so we checked that it wasn’t us. Good there.

Second, we poked through Yoast/WP SEO and would that in fact the do disable it by default. However, they also re-enable it correctly and output exactly what you’d want, so good there, too, as far as we could tell.

Third, we found a spot in WPML that could be doing it but that turned out wrong, so good there, too.

Finally, we found this post which explains that Yoast does not output that tag if a site’s robots.txt policy is set to disable indexing. That makes sense. Canonical URLs are used mostly by spiders to avoid duplicates, and if you don’t want spiders you don’t need that tag.