carbon-design-system / carbon-platform

The "next" version of the Carbon Design System website, as a platform.
https://next.carbondesignsystem.com
Apache License 2.0
21 stars 5 forks source link

Set canonical URLs #910

Open mattrosno opened 2 years ago

mattrosno commented 2 years ago

Summary

Per https://moz.com/learn/seo/canonicalization, we want to set canonical links to prevent problems caused by "duplicate" content appearing on multiple URLs. We'll want to do this in a few places.

First, we'll probably want to add a constant in the /web-app/config directory somehow that sets the domain to https://next.carbondesignsystem.com, because every canonical link has to be absolute. This is so we only would have to update the domain in one place wants we elevate to the top-level Carbon domain.

Library versions

Any page in a library that is not latest needs a canonical link set to latest. E.g. this page does not need a canonical link, because it's canonical:

https://next.carbondesignsystem.com/assets/carbon-charts-react/latest/library-assets

But this page:

https://next.carbondesignsystem.com/assets/carbon-charts-react/v0.55.1/library-assets

needs:

<link rel="canonical" href="https://next.carbondesignsystem.com/assets/carbon-charts-react/latest/library-assets" />

This applies to all pages in a library, because all pages in a library get versioned through the library.

Inherited content

We're also going to run into this with inherited content. E.g. usage content that will seem duplicated for the React button, Angular button, etc. Let's look at an example: https://next.carbondesignsystem.com/assets/carbon-react/v11.4.0/button/usage.

Option 1: Should the canonical link be the latest version of that library's button usage docs https://next.carbondesignsystem.com/assets/carbon-react/latest/button/usage?

Option 2: Or, because the content is inherited from the Carbon Styles library, would the canonical link be https://next.carbondesignsystem.com/assets/carbon-styles/latest/button/usage?

I think it should be option 2. That way, even though button usage docs could show up in many libraries, and many versions of those libraries, that content will be indexed once by Google with page views of those "duplicated" pages attributed to that one page in Carbon Styles.

Acceptance criteria

What requirements must be met to complete this request?

  1. Canonical links set where needed
mattrosno commented 2 years ago

Hey team! Please add your planning poker estimate with ZenHub @alisonjoseph @andreancardona @jdharvey-ibm