openzim / sotoki

StackExchange websites to ZIM scraper
https://library.kiwix.org/?category=stack_exchange
GNU General Public License v3.0
216 stars 25 forks source link

Redirect from `/questions/{questionId}` #277

Closed zgrmrts closed 1 year ago

zgrmrts commented 1 year ago

In stackoverflow, for example https://stackoverflow.com/questions/1642028 redirects to https://stackoverflow.com/questions/1642028/what-is-the-operator-in-c by adding human readable string at the end of the URL. However, in the sotoki image, it doesn't. If it were to work as in SO, it will make access to a question and its' answer easier in the offline version once you find it online, you just copy the question ID. Since sotoki's search is not as good as google or SO's search, I find it easier to do the search online, and access the solution in the offline version.

rgaudin commented 1 year ago

Thank you,

We only write redirects for answers, reusing the /a/{answerId} pattern used on SO. I see now that SO advertises a Share button that uses a /a/{answerId}/{yourUserId}. Not sure if it has always been the case but we can't make those full shortcuts work in the ZIM obviously.

So what's missing now is the /questions/{questionId} redirect. It's a good feature, we'll add it.

zgrmrts commented 1 year ago

/question/{questionId} seems to be addressed in issue #38 but;

  1. It is question rather than questions
  2. /a/{answerId} works but neither of /answer/{answerId}, /q/{questionId}, /question/{questionId} or /questions/{questionId} work.
rgaudin commented 1 year ago

Scraper was rewritten after #38 so it's content is not valid anymore. Sorry about that.

Thanks for noticing the typo ; changed it. Unfortunately, given the number of posts is in the dozens of millions and the fact that this is static we have to create individual redirects for each variation. You are proposing 5 different ones.

While there is value in supporting all of them, I don't think it's worth the cost.

So I suggest we keep /a/{answerId} and add /question/{questionId} for now. Maybe we should be more explicit about those redirects. We can surely add a paragraph in about page. That won't hurt. But to be really useful, we'd need to maybe add something to post pages. Not sure what that would be exactly.

zgrmrts commented 1 year ago

Actually /questions/ was the correct one (i.e used in SO). I just wanted to note that it is written as /question/ in the issue #38 because maybe it was a typo there. /q/ is also used as a shortcut, but /answer/ or /answers/ is not really supported by SO either. Thanks.