Page MenuHomePhabricator

Category tag on redirect pages does not work
Closed, ResolvedPublic

Description

Author: plugwash

Description:
on commons i redirected [[Prunus cerasus]] and [[Prunus avium]] to cherry due to
the fact that its pretty much impossible to tell them apart from a photo.

however i wanted to keep the scientific names in [[Category:Rosaceae]] so i
tried putting the category on the redirects.

it seems for some reason mediawiki will not let me do this.


Version: 1.4.x
Severity: normal
URL: http://test.leuksman.com/index.php/Category:REDIRECT's

Details

Reference
bz1476
ReferenceSource BranchDest BranchAuthorTitle
repos/sre/acme-chief!5bookworm-wikimediamainbrettci: Automatically build Debian packages
repos/data-engineering/airflow-dags!528add_analytics_datahub_hive_wmf_readershipmainjoalUpdate analytics datahub ingestion config
repos/data-engineering/airflow-dags!521T347689_fix_typomainaquFix typo in Iceberg tables database name
repos/data-engineering/airflow-dags!515add_unique_devices_icebergmainjoalUpdate analytics unique-devices dags
repos/data-engineering/airflow-dags!512update_analytics_referer_dailymainjoalUpdate analytics referrer_daily DAG
repos/sre/acme-chief!4gitlab-cimainbrettImplement Gitlab CI and Blubber config
repos/releng/gitlab-cloud-runner!286gitlab-runner-16-2mainjeltoupgrade gitlab-runner image to 16.2.1
repos/cloud/toolforge/toolforge-cli!10build_packagesmaindcarobuild packages
Customize query in GitLab

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:11 PM
bzimport set Reference to bz1476.
bzimport added a subscriber: Unknown Object (MLST).
  • This bug has been marked as a duplicate of 710 ***

plugwash wrote:

NO THIS IS NOT A DUPLICATE OF 710

This bug is about including categories ON redirect pages NOT about redirecting
to categories

redirecting TO category pages is a seperate issue (and also one that we on
commons are desperate to have resolved)

(In reply to comment #2)

NO THIS IS NOT A DUPLICATE OF 710

This bug is about including categories ON redirect pages NOT about redirecting
to categories

redirecting TO category pages is a seperate issue (and also one that we on
commons are desperate to have resolved)

I found the following (valid for mediawiki 1.3.7, 1.3.11, but in 1.5 is different):

When you create a new(!) page X with the only content

#REDIRECT [[foo]]
[[Category:foo-foo]]

Brion & Co: ATTENTION, this works(!) surprisingly in mediawiki 1.3.7 and 1.3.11:
page X is a) saved and b) the Category tag is saved and works.

However, when you reopen that page to edit something, the category tag (which is
shown) is automatically deleted by the wiki if you save the page for the second
time.

In CVS version 1.5, the [[Category:foo-foo]] is not even saved, when you create
the page, i.e. immediately cleared.

As I want to have - apparently like Peter - many pages with some short page
titles X with a #REDIRECT _and_ a [[category:Acrocynm]], this is really a
long-felt need.

Please can someone of the developers have a look into this bugzilla 1476 get it
solved ? TIA

richholton wrote:

Allows category tags on redirect pages to show on category page list,.

The issue here is primarily that of parsing. Changing the category page code to
allow the display of redirect pages is trivial. It's even "trivial" (remove one
line of code) to modify article.php with the results that category tags on
redirect pages are parsed and registered. However, doing so raises some issues:

  1. At the same time that the parser detects category tags, it will also detect

other types of links. Nothing get rendered, but those links show up in other
places: for instance "what links here" at one of the targets of those links
will show the redirect page as a redirect page to the target of the embedded
link. (The page Abc redirects to Foo, but also contains an embedded link to
Bar. At Bar, "What links here" lists Abc as a redirect to Bar). Of course, if
redirect pages don't contain embedded links, there is no problem.

  1. The speed of redirect pages will be decreased somewhat. I don't know how

significant this will be. However, as I understand it, redirect pages don't get
cached.

Special code could be written that only parses redirect pages for category
links, if that is deemed necessary.

I'm attaching a patch to 1.4.0 that does this simple change. I've only tested
under 1.5 development , but I don't see any obvious reason it shouldn't work
under 1.4.0.

Attached:

river wrote:

i'm sure i already fixed this in HEAD.

http://cvs.defau.lt/cvsweb.cgi/phase3/includes/Article.php.diff?r1=1.287&r2=1.288&only_with_tag=MAIN&f=h
http://cvs.defau.lt/cvsweb.cgi/phase3/includes/CategoryPage.php.diff?r1=1.16&r2=1.17&f=h&only_with_tag=MAIN

is this a different issue? i'm not sure i want to change 1.4's behaviour
because it's a non-trivial behavioural change.

richholton wrote:

(In reply to comment #5)

i'm sure i already fixed this in HEAD.

I hadn't noticed this change to article.php. However, when I test the HEAD code
(including your change, but not mine), any content on redirect pages after the
first line gets deleted, including category tags. Perhaps that's by design. The
effect of my additional patch is to remove this restriction.

However, the patch I included above will not, by itself, fix things for 1.4.0.
Should anyone want to use/test, then Kate's changes would also be necessary.

bdbryant wrote:

I would like to encourage adoption of the changes necessary to allow categories
to appear on #REDIRECT pages. Here's an example of why I need them:

I've been working on the WWII order of battle for German divisions. A lot of the
divisions changed their name and/or organization over the course of their
lifetimes, but it seems best to provide one article per division rather than a
separate article for every reorganization and purely cosmetic name change. After
creating such an article all the other aliases can be set up with redirects, so
people can find the article regardless of which name they want to look up. But
putting the categorization on the article sometimes leaves undesirable effects.
For example, [[Category:German panzer divisions]] ends up containing the light
divisions and even some infantry divisions in the list, which will surely baffle
people who haven't read the articles yet. And it can't be fixed by renaming the
articles, because that just moves the problem elsewhere. (E.g., we need a
category for the light divisions listing them as light divisions, and a category
for panzer divisions listing those same divisions as panzer divisions.) If I
could put categories on the redirect "alias" pages, I could clean up the
categories to be clear and precise rather than giving the appearance of
miscategorization as the do now.

Presumably the same issues come up for other classes of articles where redirects
are used to create aliases for things.

Thanks.

  • Bug 2278 has been marked as a duplicate of this bug. ***

sylvain_machefert wrote:

I'll try the patch.
I just add a note to explain another situation.
I work with greek page titles. I added them Greece category.
But for my friends who don't read greek, I created pages with latin transcription title, which #REDIRECT to the greek titled page.
I want to add the latin title page in "Greece" category.

Of course, the same problem for cyrillic letters ;)

Some friends work on Greek mythology would like this feature too.

gangleri wrote:

added the URL http://test.leuksman.com/index.php/Category:REDIRECT's

The test wiki FiverAlpha http://test.leuksman.com/ uses (now) MediaWiki: 1.5alpha2 .

To my knowledge the *only* restriction is:
to use *whatever* - categories, templates, interlanguage links (?) - in the
first line.

Please see also some test cases at
http://test.leuksman.com/index.php/Bugzilla_1476_-_Category_tag_on_redirect_pages_does_not_work

Regards Reinhardt [[user:gangleri]]

Michael.Keppler wrote:

*** Bug 491 has been marked as a duplicate of this bug. ***

Michael.Keppler wrote:

*** Bug 491 has been marked as a duplicate of this bug. ***

gangleri wrote:

*** Bug 1333 has been marked as a duplicate of this bug. ***

zigger wrote:

Changing severity back from enhancement to normal, as this was 1.3 functionality
lost in 1.4 (but restored in 1.5 alphas).

zigger wrote:

*** Bug 3344 has been marked as a duplicate of this bug. ***

Reopening bug. Still no way to categorize a redirect with HEAD.

rich wrote:

Same thing here, though it appears you can categorize a redirect using HEAD if
you place the category tags on the same line as the redirect.

gangleri wrote:

Please read bug 218 comment 15.
Bug 218: Redirects do not handle named anchors well

This is fixed in CVS currently (to be released in 1.6). You no longer need to
place the category on the same line as the redirect.

gangleri wrote:

(In reply to comment #19)

... You no longer need to
place the category on the same line as the redirect.

*note*
Please compare
http://test.leuksman.com/index.php?title=Bugzilla/01476/standard&redirect=no
and
http://test.leuksman.com/index.php?title=Bugzilla/01476/non-standard&redirect=no

The first is a "valid" REDIRECT the second not. However the second example can
be the result of a "bot" optimisation if interwiki links and categories are
placed at the top of the page source.

If this will become an issue please open another bug about changing REDIRECT
recognition.

robchur wrote:

(In reply to comment #20)

If people's bots break wikimarkup, that isn't our problem. They should be coded
not to touch the top line of a redirect page.