Businesses, especially with multiple region websites need canonical and hreflang tags in various scenarios to optimize their SEO outcomes and offer a personalized user experience to the audience. When your website has multiple URLs for different locations, but all leading to the same content for example product pages with different sorting options, using canonical tags can help you indicate the preferred URL to the search engines. This will tell Google to index the main version and consolidate link equity(the value passed through links). In this blog, let us discuss in detail what are canonical and hreflang tags, why are they important, when you need to implement them, various use cases, and most importantly how to set them.
Canonical tags
What are they?
A canonical tag is an HTML element that helps businesses manage duplicate content. These tags help search engines understand the preferred version of a web page when there are multiple pages with similar or the same content.
What is their purpose?
Canonical tags prevent duplicate content issues that usually arise when the same content is accessible via multiple URLs. When the same content is spread across multiple URLs, Google struggles to determine which version of the page to show in the results. This may lead to penalties or lower search rankings which impacts the visibility and authority of your webpages.
When to use?
- When you have multiple URLs leading to the same content.
- When content is syndicated across multiple sites.
- For printer-friendly versions of pages.
Implementation
The canonical tag should always be placed in the <head> section of the HTML of the non-preferred pages and should be pointed to the preferred URL.
<link rel="canonical" href="https://www.example.com/preferred-page" />
Hreflang tags
What are Hreflang tags?
These tags are HTML attributes that allow search engines like Google to understand the language and regional targeting of a specific webpage.
What is Hreflang tags purpose?
To display the correct language or regional version of a webpage to users based on their geographic location or language preference.
When to use Hreflang tags?
- For websites that support multiple languages content or target different countries.
- To avoid confusion and ensure that users see the right version of the web pages.
Implementation
Add the href language tags in the
section of your HTML similar to canonical tags for each version of the page by indicating the language and region.<link rel="alternate" hreflang="en" href="https://www.example.com/en/page" />
<link rel="alternate" hreflang="es" href="https://www.example.com/es/page" />
<link rel="alternate" hreflang="fr" href="https://www.example.com/fr/page" />
NOTE: Ensure that the URLs specified in hreflang tags are accessible and correct by testing. You can also use an x-default tag for a fallback version if the user preference does not match the specified languages mentioned in the language.
Key differences between the canonical and hreflang tags
- Canonical tags are used to prevent duplicate content issues by setting up a preferred version of a specified page.
- On the other hand, hreflang tags help brands serve the audience with the correct language or regional version of the site.
Recommendations
- Always make sure that both canonical and hreflang tags are implemented correctly and match the actual structure of your website.
- Conduct regular audits for the site to identify duplicate content and use proper language targeting.
- Use tools like Google Search Console to monitor the functionality of canonical and hreflang tags.
Various use cases of canonical tags
E-commerce sites: Canonical tags allow search engines to display the preferred version of multiple product pages that have the same item in different colours or sizes. E-commerce sites may often allow users to filter and sort through multiple options, these canonical tags can point to the main category page, avoiding indexing multiple versions of the same content.
- Canonical tags indicate the original source when similar content is published across multiple sites to avoid duplication penalties.
Various use cases of Hreflang tags
Multilingual websites: If a business has multilingual websites catered for different countries with different languages, hreflang tags make sure that the users are directed to the right version of the page.
Regional targeting: If a business has specific target locations, these tags help search engines serve the audience with the right version based on the location.
International e-commerce: Online e-commerce platforms that offer different products for different countries can use these tags to direct users to the correct version of the page that matches their locale.
When to Implement These Tags
Canonical Tags
- Implement when launching a new site or redesigning an existing one to prevent duplicate content issues from the beginning.
- Use when creating new URLs for existing content to maintain SEO equity.
Hreflang Tags
- Implement when launching localized versions of a website or adding new language support.
- Use when expanding into new markets or regions to ensure proper indexing and visibility.
Example Canonical and Hreflang Tags for HTML-Based Website
HTML Structure for a Page (here we have considered the name of the website to be example, this differs based on your website)
<!-- Canonical Tag -->
<link rel="canonical" href="https://www.example.com/en-in/" />
<!-- Hreflang Tags -->
<link rel="alternate" href="https://www.example.com/en-ca/" hreflang="en-ca" /> <!-- Canada -->
<link rel="alternate" href="https://www.example.com/en-us/" hreflang="en-us" /> <!-- US -->
Common Mistakes and How to Avoid Them
1) Not Using Canonical Tags at All
How to avoid: Always implement canonical tags on pages with duplicate or similar content to prevent SEO issues.
2) Incorrect Canonical URL
How to avoid: Double-check that the canonical URL points to the correct and preferred version of the content.
3) Multiple Canonical Tags on a Page
How to avoid: Ensure each page has only one canonical tag to avoid confusion for search engines.
4) Neglecting Hreflang Tags for Localized Content
How to avoid: Always use hreflang tags for multilingual or region-specific content to direct users to the appropriate version.
5) Missing or Incorrect Language Codes in Hreflang
How to avoid: Use the correct ISO language and country codes to ensure proper targeting.
6) Not Including an x-default Tag
How to avoid: Implement an x-default hreflang tag for fallback versions when none of the specified languages match the user's preference.
7) Ignoring Canonical Tags for Pagination
How to avoid: Use canonical tags to indicate the main version of paginated content to prevent the indexing of multiple pages.
8) Overusing Canonical Tags on Unique Content
How to avoid: Avoid using canonical tags on truly unique pages, as this can limit their visibility in search results.
9) Not Updating Tags After Site Changes
How to avoid: Regularly audit and update canonical and hreflang tags whenever you make changes to your site structure or content.
10) Not Monitoring Performance
How to avoid: Use tools like Google Search Console to monitor how your canonical and hreflang tags are performing and make adjustments as necessary.
Conclusion
All in all, brands should consider implementing both canonical and hreflang tags when dealing with multiple languages or regions. These tags play a crucial role in maintaining optimal SEO performance that can result in higher search engine rankings. They also help in delivering the user's right information based on their location or language preferences, offering a seamless user experience by delivering the most relevant content.