Last modified: 2013-11-21 15:04:51 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T53736, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 51736 - Redirects to sections/anchors should not depend on redirectToFragment javascript
Redirects to sections/anchors should not depend on redirectToFragment javascript
Status: NEW
Product: MediaWiki
Classification: Unclassified
Redirects (Other open bugs)
1.22.0
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: javascript
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-20 08:58 UTC by Chris McKenna
Modified: 2013-11-21 15:04 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Chris McKenna 2013-07-20 08:58:21 UTC
With Javascript disabled/not available:

*Links to sections, e.g. [[Albatross#Biology]] work correctly
*Links to sections via a redirect, e.g. [[Beiruit#History]] work correctly ([[Beiruit]] is a redirect to [[Beirut]]).
*Links to sections via a redirect to a section, e.g. [[Camden Market Fire]] takes you to the top of the target page but no the section ([[Camden Market Fire]]is a redirect to [[Camden Market#2008 Camden Market fire]]

Fixing this may partially fix the section links issue in Bug 51122
Comment 1 Krinkle 2013-09-18 03:21:27 UTC
If redirects where resolved at the URL level, this would be trivial (we'd include the fragment in the 301 or 302 Location header).

However since MediaWiki doesn't do that, there is no way that I know of to automatically skip to a section without javascript.

Example: Page [[Knight 4000]] is a redirect to section "Knight 4000" on page [[KITT#Knight_4000]]

When linking to it from within a page like "[[Knight 4000]]" it renders as <a href="./Knight_4000">. One could wonder why this isn't resolved server-side, but I imagine it has to do with caching (the redirect target can change, and the article linking to it would have to be purged).

When accessing it directly by url (/wiki/Knight_4000) the server doesn't redirect with 301 or 302, instead it responds normally with the content of the redirect target ([[KITT]] in this case) and the redirectToFragment javascript jumps to the correct section). Note that redirect pages do contain a <link rel=canonical> to avoid these from being indexed as duplicate entries.

So possible solutions:

* When accessed directly, do a proper 301 or 302 redirect instead of target content with <link rel=canonical>

* Or; if the above is infeasible or undesired: Have the MediaWiki parser resolve links inside a page to the redirect target (naturally including the fragment), so that [[Knight 4000]] would result in  <a href="./KITT#Knight_4000"></a> instead of <a href="./Knight_4000"></a>. However this is likely even less feasible as that would require us to purge all pages that link to a redirect when the redirect is edited
Comment 2 Kevin Israel (PleaseStand) 2013-11-21 15:04:51 UTC
(In reply to comment #1)
> So possible solutions:
> 
> * When accessed directly, do a proper 301 or 302 redirect instead of target
> content with <link rel=canonical>

Not going to happen; see bug 18883. This would make it impossible to include the "(Redirected from $1)" message.

So perhaps the best we can do is to add a new "(Redirected from $1 to section $2)" message, so the user can at least know what section was supposed to scroll into view, and quickly jump to that section.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links