hugolabe / Wike

Wikipedia Reader for the GNOME Desktop
https://hugolabe.github.io/Wike/
GNU General Public License v3.0
252 stars 33 forks source link

Don't add Main Page to recent articles #76

Closed vanillajonathan closed 2 years ago

vanillajonathan commented 2 years ago

Don't add the Wikipedia "Main Page" to the recent articles list.

It just adds noise and reduces the usability of the recent articles list.

hugolabe commented 2 years ago

Yes. It seems correct that the Main Page is not saved in the list of recent articles.

The problem is how to detect that it’s the Main Page, since the URL is different for each of the Wikipedia languages.

To load the main page, the Wikipedia base URL is used (eg, https://en.wikipedia.org/), but this redirects to the real URL (https://en.wikipedia.org/wiki/Main_Page), which is the one that is saved in history and is different for each language (for example, in Spanish is https://es.wikipedia.org/wiki/Wikipedia:Portada)

To be able to check it, it would be necessary to create a list with all the possible URLs, which are many (as many as languages), and compare with the entire list.

vanillajonathan commented 2 years ago

Maybe it would be possible to detect the redirect page from the base URL? It will return a response with the status code 301 Moved Permanently and include a "Location" HTTP header.

Else I would be fine with just adding an exception for the Main Page on the English language Wikipedia. It wouldn't be a perfect solution, but it would be a quick, simple and easy fix that provide real value to most users.

hugolabe commented 2 years ago

Fixed in commit 8ecf0a3a211caf8d2c99baf572a6f3a0263b93c3. I've done it by checking the URL before the redirect occurs, so it works with all languages.