Setting up custom site-specific search shortcuts in Firefox

I’ve been thinking about my use of search engines recently, particularly in the light of my disappointment with Kagi.

I am using bookmarks a lot more, and I’ve also been tinkering with archivebox (which will be the subject of a future blogpost, I expect).

I have also experimented with adding custom, site-specific, search shortcuts in Firefox.

This sounds fancier than it is; it’s just direct use of a site’s own search tool, from within Firefox.

What I mean is that, if I want to search on, for example, legislation.gov.uk, I can do so from the URL bar within Firefox, using legislation.gov.uk’s own search tool.

First, I type @leg, then the name of the legislation I wish to search, and finally I hit “Enter”.

I’ve set up similar search shortcuts for the sites which I most commonly search.

It has taken me a while to get used to it, but that’s just because it is a change from what I did before.

Setting up Firefox to allow custom search shortcuts

By default, Firefox did not let me specify custom search shortcuts in about:preferences#search.

To enable this, I:

After I did that, in search shortcuts in about:preferences#search, I had a new “Add” button, to add a custom search shortcut.

Adding a custom search shortcut

Adding each individual search shortcut is easy.

I went to the site in question, and carried out a search.

I was looking for where the search term appeared in the URL.

For instance, for legislation.gov.uk, carrying out a search for “test” results in a URL of https://www.legislation.gov.uk/primary+secondary?title=test.

Replace the search term - test - with “%s”.

This gave me https://www.legislation.gov.uk/primary+secondary?title=%s.

In about:preferences#search / Search Shortcuts, I clicked “Add”, and then added:

legislation.gov.uk
https://www.legislation.gov.uk/primary+secondary?title=%s
@leg

I clicked “Add Engine”.

And that was it: I had a new custom search shortcut for legislation.gov.uk.

The main nuisance is that I have had to set this up in on each machine I use, as I haven’t got a Firefox sync system working (and I don’t know if this would sync anyway, truth be told).

You can also do a similar thing in Firefox for Android, giving you an extra, custom, search engine option in the URL bar, but without the shortcut.