Canonical URLs in Yoast SEO
Yoast SEO adds canonical URLs to most pages in your WordPress install. It does this automatically and in 99.9% of cases you don’t have to change anything about them. If you do want to change them, there are several ways of doing so:
Change the canonical for an individual article with Yoast SEO
On the advanced tab of the Yoast SEO metabox, you can change the canonical to point to any URL.
- Log in to your WordPress website. When you’re logged in, you will be in your ‘Dashboard’. On the left-hand side, you will see a menu. Navigate to the individual article to edit the content settings.
- In the Yoast SEO metabox, click on the ‘Advanced’ gear icon.
- Enter the full canonical URL.
- Update the article.
Canonical elements for paginated archives
A common misconception is that the canonical on a paginated page should always point to page 1 in the series. This is not the case. When you do that, you run the risk of search engines not indexing links that appear on page 2, 3 etc. of your archives. This would cause older articles to drop out of the search results entirely.
Of course, you can change the canonical element of a category, tag or other taxonomy archive to point at another page. To do this, go into the taxonomies settings and set the canonical:
Change the canonical for paginated archives with Yoast SEO
- Log in to your WordPress website. When you’re logged in, you will be in your ‘Dashboard’. On the left-hand side, you will see a menu. Navigate to the archive taxonomy, like category or tags, to edit the paginated archive item.
- Under the ‘Yoast SEO Settings’ section, enter the full canonical URL.
- Click ‘Update’.
If you want, you can also filter the output of the canonical programmatically. To do this you can use the
wpseo_canonical filter. If you return false on that, no canonical will be output. Some examples can be found here.