Topic on Project:Support desk/Flow

[RESOLVED] How to disable Special:Categories

18
Zc5 (talkcontribs)

I am trying to disable the link Special:Categories at the bottom of the page (at the bottom of this page there is Category:Support Desk, I want to disable the link attached to the word "Category"). I don't want to completely remove the word but I want to disable to link (obviously it would be nice if I could get rid of the blue text and underline). Is this possible?

88.130.94.140 (talkcontribs)

Hi!

I would search the page Hooks to see, if there is a hook, which is executed somewhen when the page categories are created/rendered.

Alternatively you should be able to modify these links with JavaScript...

Zc5 (talkcontribs)

How would I be able to modify the links using JavaScript? I am very unfamiliar with JS

88.130.94.140 (talkcontribs)

Me either. ;-)

Something like that is possible with jQuery. It allows you to modify elements in the page source code - exactly what you want. ;-)

Fereal (talkcontribs)

This is easy if you are willing to modify core files. Generally it's an ill-advised practice, however it's just a very simple change and the worst thing that can happen if you upgrade/reinstall is the link comes back up again.

You can do it by going to includes/Skin.php, finding the getCategoryLinks() function and remove the function that adds the hyperlink. Which to remove depends on your MediaWiki version.

Using JS, btw, is overkill.

88.130.68.219 (talkcontribs)

Always remember: Modifying core files is evil and kills little kittens. Instead of doing it messily again and again, better do it neatly once.

Fereal (talkcontribs)

Then save the kittens by giving OP a solution.

IAlex (talkcontribs)
Fereal (talkcontribs)

Thanks, I didn't know that. OP, take this guy's advice.

88.130.68.219 (talkcontribs)

Yes, this might work - however: Technically it's still a hack.

Fereal (talkcontribs)

It does work, though using a pipe is needed. Setting it blank will generate a link to the default.

Yes, it's a hack, and there's this small percentage that it can break MW in later updates should it change how it handles it.

Still better than murdering kittens. amiryt?

88.130.68.219 (talkcontribs)

In any case not by modifying Core files. When someone else takes over the wiki - he will be glad to clean up your mess. It makes updates unneccesarily hard, you have to monotonously do the same work again and again, maintaining something like this is a pain. Once you forgot your customization, an update will even break it completely.

Fereal (talkcontribs)

As I stated, what I advised was a very light modification with no real threat. I didn't say "go modify the core to your heart's content". There is no "mess" to be made which is why I advised in the first place.

If you hadn't noticed, many things are hardcoded into MediaWiki making customization even harder. If you can't differentiate which necessary risks must be taken and which should be avoided, and keep blindly sticking to the rules, then good luck with the kittens.

88.130.68.219 (talkcontribs)

It always are the "small light, 100%-safe changes", which make systems break. Also at least not for the OP it can't be so easy, or he would have done it himself. Apart from that there have been more than three possible ways to solve the issue without modifying core files. I am still in favour of the JavaScript approach.

Zc5 (talkcontribs)

Haha thanks guys!!

I loved reading all of that! That was entertaining/informative.

I guess I should elaborate more on what I am trying to do. I have been using dumpHTML to convert my wiki to a static html output. Unfortunately not everything coverts perfectly (all of the special pages e.g, Special:Categories) So i was just trying to find a shortcut to removing it in the wiki so I don't have to deal with it in the output.

Instead of altering the wiki, I decided to take a different approach (probably safer, less kitten killing, and better) and alter the dumpHTML code.

In case anyone is curious, I just added a jquery script (see below) that deleted the href and replaced it with the word "Categories"

$("#mw-normal-catlinks a[href='../../../../articles/c/a/t/Special%7ECategories_101d.html']").replaceWith('Categories');

I appreciate all your help and all the input you put in!

88.130.68.219 (talkcontribs)
$("#mw-normal-catlinks a[href='../../../../articles/c/a/t/Special%7ECategories_101d.html']").replaceWith('Categories');

Yes, that's the kind of solution I thought of. :-) Overkill... ;-)

Fereal (talkcontribs)

Oh, so you were doing it for HTML conversion. I thought you just didn't want visitors to see the link, in which case JS is fine.

However, for future reference to people looking to remove the link, use IAlex's solution by modifying MediaWiki:Pagecategorieslink with a "|" (pipe) character.

Javascript is not a solution for these kinds of trivial problems. Not only does it put unnecessary overhead to the visitors, but it will ultimately fail if they have JS disabled in their browsers.

MW's not a perfect software, and if you're not willing to make compromises for simple 'hacks', well then good luck finding a perfect world. Even Wikipedia's infoboxes are full of workarounds.

Zc5 (talkcontribs)

Ya I agree, I apologize I did not clarify more and I will definitely use your suggestion if other admins agree it is unnecessary.

I agree that doing internal changes by modifying things like MediaWiki:Pagecategorieslink is the best approach. Adding JS is an "easy fix" which can come back in bite you in the butt later down the road. Especially since I never considered that visitors could have JS disabled on their own browsers which would cause multiple problems.

Thank you for your input, I hope other users find this topic useful!

Reply to "[RESOLVED] How to disable Special:Categories"
  NODES
HOME 1
Intern 1
Javascript 4
languages 2
os 3
text 4
Users 1