Your URL bar is a CLI (2020)

gaws1 pts0 comments

Your URL bar is a CLI – River Writes - A MediaWiki Blog

This page looks best with JavaScript enabled

Your URL bar is a CLI

📅 Sep 8, 2020

· ☕ 9 min read

🏷️

#firefox

#leaguepedia

Back in March, I wrote a post about gadgets in which I briefly mentioned making keyword-search bookmarks with namespace-specific restrictions to be able to easily search for code, and concluded with, “More on that later….” Well, it took me six months to get to it but here’s that post finally!

A note on browser support

This article is about Firefox.

My original plan for this article was to do a quick search to see how to do the equivalent setup in Chrome and make it browser agnostic. However, that quick search revealed that in fact the equivalent setup is drastically different - instead of editing bookmarks, you edit search engines, so if you use Chrome then all I’m going to is give this brief mention that you can probably do something similar in Chrome and leave you on your own to figure out the rest. Or switch to Firefox, support the open Internet.

Now, onto the cool stuff you can do.

Direct keywords

After you save a bookmark, you can go back to it, right-click, go to Properties, and then add a Keyword. I typically make the keyword the same as the name, which is to say that I make the name the same as the keyword; the keyword is the functional and important part. If you type the keyword into your url bar, it will send you to the bookmark.

For example, lolfp (short for “lol front page”) is the keyword for the bookmark https://lol.gamepedia.com; when I type ctrl+L then lolfp I’m sent to my wiki’s home page.

Nice, we can bookmark some things like:

Name<br>Keyword<br>Target

lolfp<br>lolfp<br>https://lol.gamepedia.com

lolrc<br>lolrc<br>https://lol.gamepedia.com/Special:RecentChanges

lolcss<br>lolcss<br>https://lol.gamepedia.com/MediaWiki:Common.css

lolcssme<br>lolcssme<br>https://lol.gamepedia.com/Special:MyPage/common.css

loljs<br>loljs<br>https://lol.gamepedia.com/MediaWiki:common.js

loljsme<br>loljsme<br>https://lol.gamepedia.com/Special:MyPage/common.js

lolbp<br>lolbp<br>https://lol.gamepedia.com/Special:BotPasswords

loldr<br>loldr<br>https://lol.gamepedia.com/Special:DoubleRedirects

lolbr<br>lolbr<br>https://lol.gamepedia.com/Special:BrokenRedirects

Single-substitution keywords

Let&rsquo;s go one step farther. Firefox allows you to make a substitution of a single input after your keyword into a %s in your target. For example, if your target is https://lol.gamepedia.com/index.php?search=%s&title=Special%3ASearch (note the %s after search=) and you type lol Faker then you will be redirected to https://lol.gamepedia.com/index.php?search=Faker&title=Special%3ASearch. (If you actually click this link, MediaWiki will then further redirect you to Faker&rsquo;s page, https://lol.gamepedia.com/Faker.)

Here are some useful examples:

kw<br>Target<br>Comment

lol<br>https://lol.gamepedia.com/index.php?search=%s&title=Special%3ASearch

loltest<br>https://lol.gamepedia.com/Special:MyPage/%s<br>Easy sandbox pages!

urmlol<br>https://lol.gamepedia.com/Special:UserRights/%s<br>This violates my conventions of starting with &ldquo;lol&rdquo; but is what I used historically

lolct<br>https://lol.gamepedia.com/Special:CargoTables/%s<br>omitting any argument after lolct takes you just to Special:CargoTables

lolcd<br>https://lol.gamepedia.com/Template:%s/CargoDec<br>Discipline with naming conventions on-wiki is important so your keywords work!!!

lolsm<br>https://lol.gamepedia.com/index.php?search=insource%3A%s&title=Special:Search&profile=advanced&fulltext=1&ns828=1<br>insource, in module ns

lolsmw<br>https://lol.gamepedia.com/index.php?search=insource%3A%s&title=Special:Search&profile=advanced&fulltext=1&ns8=1<br>insource, in mediawiki ns

lolst<br>https://lol.gamepedia.com/index.php?search=insource%3A%s&title=Special:Search&profile=advanced&fulltext=1&ns10=1<br>insource, in template ns

lolsd<br>https://lol.gamepedia.com/index.php?search=insource%3A%s&title=Special:Search&profile=advanced&fulltext=1&ns10008=1<br>insource, in data ns

lolmwd<br>https://lol.gamepedia.com/MediaWiki:%s<br>d is for direct (as opposed to insource), maybe this should be loldmw

lolt<br>https://lol.gamepedia.com/Template:%s<br>this should really be loltd (or loldt)

These module, MediaWiki, template, and data namespace search keywords are what I was talking about back in March when I mentioned namespace-specific searches for looking for code.

Multiple-substitution keywords

Now say you want to make more than one substitution in your URL, for example you want to search an arbitrary string in an arbitrary wiki - useful in particular if you work with a very large wiki farm, such as I do with Gamepedia. Then you need to fill in both the domain of the wiki and also the search string. This is possible, but it requires use of a JavaScript bookmarklet. It&rsquo;ll look something like this:

The full bookmark in the screenshot is as...

gamepedia https search special keyword insource

Related Articles