Canonical URLs in Yoast SEO

Canonical URLs in Yoast SEO

Yoast SEO (free or Premium) adds canonical URLs to your WordPress website for all content that has been marked for indexing by the search engines. It does this automatically and in 99.9% of the cases, you don』t have to change anything about them. If, however, you do want to change the canonical, follow the steps below.

Table of contents

What are canonical URLs?How to change the canonical URL Canonical elements for paginated archivesDeveloper codeTroubleshooting

What are canonical URLs?

You might have posts or pages on your site with similar content. For example, you could have products or content that can be found on multiple URLs. To avoid confusing search engines, you can tell search engines which URL contains the original content. You do this by adding a canonical URL in the Advanced settings of the Yoast SEO meta box.

How to change the canonical URL

You can enter a different canonical URL for each piece of content in a separate field in the Advanced section. Follow these steps to make the changes. Log in to your WordPress website. You are now in your 『Dashboard』. Navigate to the post, page, or taxonomy that you want to change. On the left-hand side, you will see a menu that allows you to navigate to your posts, pages, and other content. Navigate to the individual item to edit the content settings. For posts and pages, scroll down to the Yoast SEO meta box. Click the 『Advanced』 section (which is under the 『SEO』 tab). Enter the full canonical URL, including http/s and www or non-www, in the 『Canonical URL』 field. Update the post, page, or taxonomy.

Canonical elements for paginated archives

In Yoast SEO we also add tags to paginated archive series. Those are the rel="next" and rel="prev" tags, that give search engines more information about your content. If the tags don』t work on your paginated content, read this article about paginated content.

Developer code

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.

If you are not sure how or where to put the filter you may wish to consult a Yoast partner who can help.

Troubleshooting

I do not have a canonical tag

In some cases you may not see a canonical tag being outputted on a page. If this is the case, check to see if the page has a noindex tag. If it does, that is the reason why. We do not output a canonical tag if the page is marked as noindex. To resolve the issue mark the pages as index.

Do you need specific answers to your own specific questions? Get Yoast SEO Premium and you will have 24/7 email access to our knowledgeable support team!

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注