huridocs / uwazi

Uwazi is a web-based, open-source solution for building and sharing document collections
http://www.uwazi.io
MIT License
237 stars 79 forks source link

We are creating canonical broken links #6754

Closed txau closed 4 months ago

txau commented 4 months ago

Uwazi adds a canonical URL for each page of the document viewer. This is rendered at the document header tag.

<link data-react-helmet="true" rel="canonical" href="[/en/entity/waf7l0q3trdd9529?page=42](view-source:https://summa.cejil.org/en/entity/waf7l0q3trdd9529?page=42)"/>

The problem being that when documents have different number of pages these canonical links are pointing to the wrong page of the wrong documents.

  1. Go to a document with more than one main file with different number of pages. Ie. en/entity/waf7l0q3trdd9529
  2. Click on "View" on the main file with more pages (Spanish in the example)
  3. Scroll to a page that has a higher page number than the amount of pages of the other document (ie page 42 in the example)
  4. Inspect the canonical URL, it is adding the page to the canonical but for the wrong file
konzz commented 4 months ago

Probably this line is the culprit: https://github.com/huridocs/uwazi/blob/b433ef351fb1c56aad53c6eec58d28a1711bdd98/app/react/Viewer/PDFView.js#L110