Magnifying glass icon gives a drop down to open Keyword Search extension

Easier, Faster Web Searches with Keyword Search Extension for Safari

I’m reasonably skilled at searching the web, especially using a little search trick I learned years ago. Let’s say you want to find the diagram I made for all of the new Pro and Max 14” MacBook Pros. You know it’s somewhere on podfeet.com, and you could navigate there first and then use my search box, but if you’re already at your search engine of choice, there’s a better way.

Simply type your search term(s), followed by the word “site:urlOfSite” as in this example where I’m going to look for the two words “diagram” and “max” on podfeet.com:

diagram max site:podfeet.com

This will give you a list of search results on your search engine’s site. In my example, the first result will be a link to my blog post containing the diagram to help you choose the right 14” MacBook Pro.

If you’d rather, you can type the “site:urlOfSite” first, and follow it with the search term(s). This will become important later in the story.

I use this method to search sites all the time because it’s often difficult to find the search box on the site I want to search. Why bother looking for that search box if I get the result I want while at the comfort of my search engine’s home page? It’s a great method that really allows me to narrow my searches down quickly to the relevant website. I search podfeet.com so often with this method that I created a TextExpander snippet for it!

But on a recent Clockwise Podcast, Dan Moren brought up a way to do this even more easily for sites you search often, using a free Safari extension that works on macOS, iPadOS, and iOS. The extension is called Keyword Search.

I’ll explain how to install and configure the extension in a moment but first, let’s talk about how it solves the same problem but in a more efficient way.

Why is the Keyword Search Extension Better?

With the Keyword Search extension enabled, you can type a single letter, or just a few letters to designate the site you want to search, followed by your search terms. Let’s say you want to search Wikipedia for “warthog”. With the Keyword Seach Extention, you can simply type into your search bar, “w warthog” and you’ll immediately be directed to Wikipedia open to the warthog page. You don’t have to navigate to Wikipedia after searching, you’re already there. I find that magical.

When you install the Keyword Search extension, it comes preloaded with a bunch of common websites like the Wikipedia example I just used. This is useful not just because it saves you some work, but by perusing the examples you start to learn how the extension does its magic and you’ll learn how to make your own little keywords for the searches you do often.

By inspecting the Wikipedia example, you’ll see that you can have multiple options for the keyword. For example, you can trigger a search of Wikipedia with w, or wi, or sw (as in “search Wikipedia”).

The examples also demonstrate that you might have to do a little bit of sleuthing to create your own Keyword searches for the websites you search often.

There are two main advantages of the Keyword Search Extension. Firstly, you type fewer characters. Secondly, you are immediately taken to the website you’re searching instead of having to click again from your search engine to get to the website. Because we’re using a Safari Extension, any keyword search you create on any iOS or macOS device is automatically available on all of your other iCloud-connected devices. While typing out “site:wikipedia.com warthog” on the Mac isn’t that bad, it’s a game-changer to type only “w warthog” on a tiny iPhone keyboard.

Hopefully, I’ve intrigued you enough with the concept that we can take a step back, and walk through the installation and setup of the Keyword Search extension for Safari.

Download the Extension

Keyword Search in the Mac App Store
Keyword Search in the Mac App Store

Most people have installed extensions into browsers before, but since extensions on iOS Safari are brand new, I’m going to walk through it in case you haven’t done it before. For completeness sake, I’ll explain it quickly on macOS Safari first.

On macOS, if you open Safari, in the menu bar select Safari, and then Safari Extensions. This will open the Mac App Store showing you all of the extensions available for Safari. Search for the Keyword Search extension, or better yet go to the link in the show notes that will take you directly to Keyword Search in the Mac App Store.

Once you’ve found Keyword Search in the Mac App Store and installed it, inside Safari you need to go to Safari Preferences and then to the Extensions tab to enable it. It’s an easy step, but it’s always confusing to me that if I go to the menu and select Safari Extensions, I don’t see my extensions, I’m back in the App Store. Ok, enough whining about the App Store.

Keyword Search in iOS App Store
Keyword Search in iOS App Store

Switching gears to iOS, again search for Keyword Search in the App Store. Surprisingly, you can also use the same link I gave you to Keyword Search for the Mac, but by accessing it from your iPad, iPhone or iPod Touch you’ll get the correct version in the iOS App Store.

Safari Preferences Toggle on Extenstion
Toggle On Extension in Safari Settings

Once an extension is downloaded to your iOS device, you need to enable it. Open Settings → Safari → Extensions, tap on Keyword Search and toggle it on. You’ll notice in this same menu, there’s a link to look at more extensions. This will take you into the App Store to discover more extensions, like the awesome 1Password extension.

It made me really happy when I was toggling on Keyword Search in iOS extensions, I noticed that it explicitly says Keyword Search does not have permission to read, alter, or transmit content from any web pages.

How to Configure Keyword Search

Magnifying Glass in macOS Safari
Magnifying Glass in macOS Safari

Once you have Keyword Search installed and activated, on macOS you’ll see a new icon in the toolbar that looks like a little magnifying glass. On iOS, there isn’t enough room to have a proper toolbar, so they collapse all extensions into an icon of a puzzle piece. On the biggest phones and on iPadOS, you’ll see the puzzle piece right in the URL field, but if your phone isn’t huge, tap the aA icon to find the puzzle piece where it’s clearly labeled “Manage Extensions”.

Tap on the puzzle piece to reveal all of your extensions, one of which will be Keyword Search. From here on out, Keyword Search is identical on macOS and all iOS/iPad OS devices.

As I mentioned earlier, when you select Keyword Search in your list of extensions, you’ll see that it’s pre-populated with some common websites to show you how easy it is to configure. For example, you’ll see in the dropdown “Amazon – sa”.

Let’s break this example down in how it was created. If you tap on the chevron to the right of any of the examples, you’ll see the fields you can fill out to create your own search keywords or modify the ones they’ve created for you. First, you give it a human-readable name; in this example, they called it Amazon. You can name it anything you want when you create the Keyword Search but using the name of the site makes sense.

The next field is the keyword(s). You’ll see in the Amazon example that they’ve used “sa” to mean “search Amazon. You can add additional keywords if you like. Perhaps “az” would be an easy-to-remember keyword for you. Simply separate the keywords with commas and you’re in business. Think about trading off how often you search a site against how many characters you want to search. I search podfeet.com all the darn day, so “sp” is a super short keyword to search my favorite site.

Keyword Search comes prepopulated with keyword searches for Amazon, Archive.org, Down for everyone or just me, DuckDuckGo, eBay, Google (oddly enough), Google Images, Google maps, IMDB, Stack Overflow, Wikipedia Wolfram Alpha, and YouTube.

Expansion Explained

If you only ever use Keyword Search to search the sites the developer has already set up for you, then you can stop learning right now. But if you’d like to tailor the extension to search sites not already in the list, such as podfeet.com, then we have to do a bit more work.

The next section is entitled Expansion and that’s where things get interesting. Expansions are URLs that include the website you want to search, plus what’s called a query string after the URL. You’ve probably seen query strings but may not have known what they were called. If you’ve ever noticed a question mark followed by more text in a URL, that’s a query string.

The tricky bit here is that websites don’t all use the exact same pattern for searching with a query string. You need to do a bit of sleuthing to figure out what pattern they use, but it’s not hard at all. Start at the website you want to be able to search with the extension, and use their search box to search for something. The URL that gets returned will show you the pattern you’ll need for Keyword Search. An example is in order.

Keyword Search Small Steps Pod Example
Keyword Search Small Steps Pod Example

Let’s say you’re a big fan of the Start with Small Steps Podcast by Jill from the Northwoods. Navigate to smallstepspod.com and use her search box to search for anything you like. I’ll search for weight loss. In the URL bar I see:

https://smallstepspod.com/?s=weight+loss

To create a new Keyword Search entry for smallstepspod.com, we can tap the Add New button, enter the name Small Steps Pod and choose a keyword or two (I chose ssp). For the Expansion, I’ll copy in the URL I got back from searching her site, not including “weight+loss”, e.g. https://smallstepspod.com/?s=. We have to do one more thing here, and that’s to add a placeholder for the search term, which is “@@@”. I know that sounds super clumsy, but when you see it written it’s not that bad. It’s one of those things that takes way longer to try to describe clearly than it does to execute.

Smallstepspod.com is a pretty sensible-looking example, so don’t get intimidated if you see a really weird-looking one. I mentioned that they’ve prepopulated the extension with the search for eBay and it’s SUPER weird. Instead of ?s= like Jill’s site, eBay’s search ends with ?\_nkw=. I have no idea what that means but it’s just as easy to copy and paste from a test search as any other site.

I’ve added a few sites I search all the time, but to be honest, the sites they included are most of what I need. Today I was trying to download an update to an application, but the website wasn’t responding. I remembered that Keyword Search used “down” as the keyword for downforeveryoneorjustme.com, so I simply typed “down” and the site I was trying to get to and discovered the site I needed was indeed down. I normally search for images by using my URL bar in Safari to search Google and then I hit the Images tab to get the results I want. This week I needed an image and I simply typed “gi” in my search bar followed by what I was looking for and boom, done in one step.

Workaround for Static Sites

One of the sites I search often is Bart’s Programming By Stealth show notes. These are at pbs.bartificer.net. Unfortunately, the Keyword Search extension won’t work on his site because it’s what’s called a static site. That means it’s not being generated by a server-side tool like WordPress, so there’s no way to send a query string to it. It’s actually a set of pages created by GitHub, the version control system used by most programmers.

By using GitHub pages, Bart and I can collaboratively work on the text even at the same time and then push our changes to GitHub, which will, in turn, auto-generate the pages. Limitations come with this approach (have you noticed there are no comments?) But from Bart’s perspective, that lack of flexibility is a lack of complexity. He has far less to manage than I do with a WordPress installation. (Ask me about how much time I’ve had to put into WordPress and my database this week!)

Text Replacement in System Preferences for PBS Show Notes
Text Replacement in System Preferences for PBS Show Notes

While I was disappointed that I couldn’t use Keyword Search to take me right to the results I want on pbs.bartificer.net on whatever device I was using, I came up with a workaround that will get me partway but not all the way to what I want.

I took advantage of the text replacement functionality for macOS and iOS to create something like keywords. Remember our trick that if we type “site:” followed immediately by the URL you want to search, you’ll get search results only for the site you requested?

Using that idea, in System Preferences/Keyboard/Text, I created a text replacement that would let me search the Programming By Stealth shownotes just as quickly as with Keyword Search. In Text Replacements, I told it to replace “sb“ with “site:pbs.bartificer.net”. Text replacements expand instantly if you type a space after them, so now if I want to search the Programming By Stealth notes right from the URL bar in my browser, I can type “sb” followed by the search term I want. “sb” automatically expands to site:pbs.bartificer.net so the only search results I get are within the PBS show notes.

This is pretty cool, and since text replacements sync over iCloud, I can use this on any of my iOS or macOS devices. It’s not as cool as the Keyword Search extension though, because it leaves me on my search engine’s home page. If the term I was searching is only mentioned once on a site, then I’d much rather be taken right to the site instead of having to click again to get there. It’s not terrible, but it’s an extra step, and automation is all about eliminating extra steps.

Advanced Settings

Keyword Search Advanced Settings
Keyword Search Advanced Settings

There’s one part of Keyword Search we should cover. In Advanced Settings, there are three sections. Remember when I searched for “weight loss” on SmallStepsPod.com? The search query put a “+” sign between “weight” and “loss” because URLs don’t work with spaces in them so there must be a separator.

In Keyword Search’s advanced settings for individual sites, it explains that the default is to replace spaces with “+”, but for a specific website, it may use a different character to separate the words in the search. When you do your test search to get the right format for the query string on a site, pay attention to what separator they use. If it’s not a “+”, just add the separator you do find to the Space Replacement section under Advanced Settings.

The next Advanced setting allows you to choose whether or not to URL escape the search phrase. Escaping in computer lingo means replacing characters that might be misinterpreted incorrectly because they’re unexpected.

For example, if you use the search box on smallstepspod.com for “weight loss” without quotes around it, you’re likely to find every time Jill talked about “weight” or “loss”. But if you put the search terms into quotes, you narrow down your search to just where she talked about weight loss.

But query strings in URLs can’t contain quotes, so Keyword Search needs to substitute characters for the quotes. If you have the URL escape box checked, which it is by default, and you enter the keyword search followed by “weight loss” in quotes, Keyword Search will replace both of the quotes with %22 which believe it or not is the official way to encode those pesky spaces in URls. If you’re not sure what I’m talking about, just leave that checkbox for URL escape checked and move along.

If you uncheck the URL escape box in the Keyword Search query string, you will still get search results but they will be in your search engine, not inside the site directly. There must be some edge case where this is useful but I’ve never come across a circumstance where I’ve needed it.

The final setting under Advanced is interesting. By default, you’re expected to put the keyword first and follow it with the search term, but there’s a dropdown to allow you to put it at the front or end of what you type. This would allow you to type “weight loss ssp” or “ssp weight loss”.

If you want to be able to change all sites to allow the search term before the keyword, there’s a global setting you can change as well.

Bottom Line

The bottom line is that I’ve managed to make this sound much more complicated than it actually feels to use it. As I said, if you’re happy using keywords just to search Amazon, Archive.org, Down for Everyone, DuckDuckGo, eBay, Google, Google Images, Google Maps, IMDB, Stack Overflow, Wikipedia, Wolfram Alpha, and YouTube, then you never need to learn how to make your own queries. But if you do want maximum flexibility, now you know how.

Keyword Search is free and open source (licensed under the Mozilla Public License 2.0), it collects no data from you, and it will improve your productivity by reducing typing on Mac, iPad and especially on iPhone. If I could find a button to buy a coffee for Norwegian developer Arne Martin Aurlien, I would totally push that button.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top