Rosetta Code:Village Pump/Add link anchors to Language Category pages

From Rosetta Code
Add link anchors to Language Category pages
This is a particular discussion thread among many which consider Rosetta Code.


Suggestion to add Anchors to specific language examples


I think it would be helpful if all the Language Category pages (ie., /wiki/Category:[lang]) had the example links include an anchor to the specific language example (eg., /wiki/MD5#Rust or /wiki/Leap_year#Ada )

+1. I found this site with the expectation to learn one new language based on another, so I'm only ever interested in 2 languages on each task page and the rest is clutter I have to wade through. This would be a massive UX improvement for a (theoretically) small change.
+1 from me too. I would much rather have to occasionally key Home to get back to to top of the page, than always have to find and click the language I'm obviously interested in, that is when I've just come from say the main Go or JavaScript or Phix page. --Pete Lomax (talk) 18:02, 6 June 2021 (UTC)
It is unlikely that the site code is going to change to do this. Mediawiki doesn't support that by default, and no-one with sufficient permissions to hack the functionality in seems to have the time or enthusiasm to implement and support it.
All hope is not lost though. I hacked together a Tampermonkey (or Greasemonkey for you old-school Firefox users) javascriptlet to automatically add the appropriate language parameter to the language category task entry links. It works for every language I tried. (I specifically tested every one of the top 30) and should work for pretty near any language that actually has entries. (There is a bug for languages that don't have any entries, but it doesn't really bother anything since it is unlikely anyone will be following task entry links if there are no task entries. ¯\_(ツ)_/¯).
Anyway, it would be nice if some people would give it a try and maybe get some feedback. If you don't have Tampermonkey or Greasemonkey installed, install one of those first; navigate to the applet page (Github gist), on that page, click on the file name, (Language_links.user.js), then click the Raw button. *monkey will then offer to automatically install. Install it then navigate to a Rosettacode Language Category page and click on some task links. Leave feedback. Have the appropriate amount of fun. --Thundergnat (talk) 15:42, 8 June 2021 (UTC)
Excellent, works a charm! --Pete Lomax (talk) 18:09, 8 June 2021 (UTC)