mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
125 stars 41 forks source link

[Task]: Include canonical <link> for user review pages #14873

Closed diox closed 1 month ago

diox commented 3 months ago

Description

Currently, our add-on user review pages:

We should:

Just adding this in src/amo/pages/AddonReviewList/index.js should probably take care of the first 2 items:

{addon && !reviewId && (
  <HeadLinks />
)}

Acceptance Criteria

### Acceptance Criteria
- [ ] `<link rel=canonical>` is set correctly in user review pages
- [ ] `<link rel=alternate>` is set correctly in user review pages
- [ ] `rel=nofollow` is set on links on the add-on detail page filtering user reviews by score

Checks

┆Issue is synchronized with this Jira Task

diox commented 1 month ago

Add a <meta name="robots" content="noindex, follow" /> when score is passed

We actually don't need to do that if a <link rel=canonical> is set correctly (pointing to the page without any query string). If search engines do stumble upon the URL with the score being passed and the canonical link on that page points them to the URL without any query string, we should be OK.

ioanarusiczki commented 1 month ago

I checked with https://addons-dev.allizom.org/fr/firefox/addon/ghosttext/reviews/, found:

rel="canonical" with href="https://addons-dev.allizom.org/fr/firefox/addon/ghosttext/reviews/" even when ?score is passed rel="nofollow" for the links from the add-on detail page which filter reviews by score

I don't see <link rel=alternate> for languages, I'm looking into html's head on reviews page.

diox commented 1 month ago

It see them:

(...)
<link data-react-helmet="true" href="https://addons-dev.allizom.org/en-US/firefox/addon/ghosttext/reviews/" hrefLang="x-default" rel="alternate"/>
<link data-react-helmet="true" href="https://addons-dev.allizom.org/en-US/firefox/addon/ghosttext/reviews/" hrefLang="en" rel="alternate"/>
<link data-react-helmet="true" href="https://addons-dev.allizom.org/pt-PT/firefox/addon/ghosttext/reviews/" hrefLang="pt" rel="alternate"/>
(...)
ioanarusiczki commented 1 month ago

I had https://addons-dev.allizom.org/en-US/firefox/addon/ghosttext/reviews/?utm_content=homepage-primary-hero&utm_medium=referral&utm_source=addons.mozilla.org because I navigated to the detail page from the primary hero suggestion, in this case I only saw the canonical link.

Once I removed ?utm_content=homepage-primary-hero&utm_medium=referral&utm_source=addons.mozilla.org they show up.

diox commented 1 month ago

Yeah, that's expected.