linkedpipes / dcat-ap-viewer

Viewer of DCAT-AP 2.0.1 compatible dataset metadata
MIT License
6 stars 6 forks source link

Include canonical tag for dataset pages #109

Closed jakubklimek closed 5 years ago

jakubklimek commented 5 years ago

Pages like PrivacyTerms https://data.gov.cz/dataset?iri=https://data.gov.cz/zdroj/datová-sada/184993252&lang=cs should include a canonical meta tag so that Google understands that it is the same as https://data.gov.cz/dataset?iri=https://data.gov.cz/zdroj/datová-sada/184993252 - currently, it thinks the cannonical page is https://data.gov.cz/datasets

For details see https://support.google.com/webmasters/answer/7440203#duplicate_page_without_canonical_tag

jakubklimek commented 5 years ago

Also see https://support.google.com/webmasters/answer/189077?hl=en for pointing to language versions of a page

jakubklimek commented 5 years ago

This also goes for dataset search pages - basically, every page that can be accessed (navigated to) using URL params should have a canonical link and language alternates links

jakubklimek commented 5 years ago

For 1 dataset, the canonical link should always link to one URL. Currently, from english page, canonical points to /dataset/ and from Czech to /datová-sada/. I think in NKOD, it should be /datová-sada/ in both version since NKOD is primarily Czech.

skodapetr commented 5 years ago

From https://yoast.com/hreflang-ultimate-guide/#hreflang-canonical

<link rel="canonical" href="http://example.com/">
<link rel="alternate" href="http://example.com/" 
  hreflang="en" />
<link rel="alternate" href="http://example.com/en-gb/" 
  hreflang="en-gb" />
<link rel="alternate" href="http://example.com/en-au/" 
  hreflang="en-au" />

If we were on the en-gb page, only the canonical would change:

<link rel="canonical" href="http://example.com/en-gb/">
<link rel="alternate" href="http://example.com/" 
  hreflang="en" />
<link rel="alternate" href="http://example.com/en-gb/" 
  hreflang="en-gb" />
<link rel="alternate" href="http://example.com/en-au/" 
  hreflang="en-au" />

Don’t make the mistake of setting the canonical on the en-gb page to http://example.com/, as this breaks the implementation. It’s very important that the hreflang links point to the canonical version of each URL, because these systems should work hand in hand!