Add a canonical tag to a filtered page

Description: The page https://example.com/shoes/?sort=price&color=red shows the same shoes as https://example.com/shoes/ with a filter. Add a canonical tag so that search engines index the main page.

Hint:

  • Put the tag in the head and use the full URL of the main page.

Solution

<!-- On https://example.com/shoes/?sort=price&color=red -->
<head>
  <link rel="canonical" href="https://example.com/shoes/">
</head>

How it works

  • The canonical tag tells Google that the clean URL is the preferred version.
  • The main page itself should have a self referencing canonical with its own URL.

Read Canonical URLs.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.