hub
hub copied to clipboard
Unexpected behavior / Destination is Wikimedia Commons / Destination should be Wikipedia article
Hello maxlath,
Wikidata : Q26693912
Wikipedia : https://pl.wikipedia.org/wiki/Ko%C5%9Bci%C3%B3%C5%82_%C5%9Bw._J%C3%B3zefa_Robotnika_w_Chocianowie
https://hub.toolforge.org/Q26693912
Destination: https://commons.wikimedia.org/wiki/Category:Saint_Joseph_church_in_Chocian%C3%B3w
Why is the destination not the article "https://pl.wikipedia.org/wiki/Ko%C5%9Bci%C3%B3%C5%82_%C5%9Bw._J%C3%B3zefa_Robotnika_w_Chocianowie" ?
The hub looks at the accept-language header to determine your favorite language, with English as default value. In your case, there would be several ways to get the desired page:
- set the
accept-languageheader topl:curl -I -H 'accept-language: pl' https://hub.toolforge.org/Q26693912 - set the
langquery string parameter topl:curl -I https://hub.toolforge.org/Q26693912?lang=pl - set the
sitequery string parameter towpto indicate that you prefer a Wikipedia page, whatever the language:curl -I https://hub.toolforge.org/Q26693912?site=wp
Thanks
https://hub.toolforge.org/
Default
By default, the destination is Wikipedia in the user language, which is guessed from the request accept-language header, falling back to English if the language header can't be found or the Wikipedia page doesn't exist in this language.
I thought, the default destination Wikipedia remains as the default destination even when the language header doesn't fit to the existing Wikipedia page. In the case of Q26693912 the hub redirects not to the only existing polish Wikipedia page but changes the default destination to Wikimedia Commons and redirects to Wikimedia Commons.
Another example: https://www.wikidata.org/wiki/Q26693912 = Īle (latvian settlement) 4 WP-entries (et, lt, lv, ru)
accept-language header = de, no existing English page
Request: https://hub.toolforge.org/Q13416642
Redirection: https://et.wikipedia.org/wiki/%C4%AAle
In the case of Q13416642 the hub redirects to the estonian WP-page. Why?
Is it possible to customize the fallback chain like: https://hub.toolforge.org/Q13416642&fallback=https%3A%2F%2Fhub.toolforge.org%2FQ13416642?s=wp&l=lv If the accept-language header is "de" and there are no german or english pages in Wikipedia, redirect to the latvian (lv) page, because the town Īle is located in Latvia.
The easy solution: https://hub.toolforge.org/Q13416642?s=wp&l=de,en,lv But this customized request will not work if the request will be sent from France or Italy with an accept-language header "fr" or "it".
In the case of Q13416642 the hub redirects to the estonian WP-page. Why?
I guess that's because that's the first sitelink alphabetically, so in absence of a matching preferred language, that's the next best thing
Hi maxlath and thank you!
Is it possible to customize the redirection of Wikidata Q13416642 (= Īle Town in Latvia, WP-pages et, lv, lt, ru) like https://hub.toolforge.org/Q13416642?s=wp&l=*,en,lv
- = accept-language header
Desired behaviour: Redirect Q13416642 to Wikipedia-Page, in absence of a matching preferred language * fallback to the english version and if this fails to the latvian version of Wikipedia.
I gave it a try in 232dcde: you should now be able to do that with https://hub.toolforge.org/Q13416642?s=wp&l=auto,en,lv
Hallo maxlath,
thank you very much for this further development of the configuration.
Zitat von maxlath @.***>:
I gave it a try in 232dcde: you should now be able to do that with
https://hub.toolforge.org/Q13416642?s=wp&l=auto,en,lv-- Reply to this email directly or view it on GitHub: https://github.com/maxlath/hub/issues/21#issuecomment-1012006482 You are receiving this because you modified the open/close state.
Message ID: @.***>
-- Sincerely Yours
Thomas Urban Sömmerringstr. 26 60322 Frankfurt 069/593549 // 06462/1327 @.***