{"id":25311,"date":"2022-02-18T07:46:17","date_gmt":"2022-02-18T15:46:17","guid":{"rendered":"https:\/\/www.podfeet.com\/blog\/?p=25311"},"modified":"2022-02-18T07:46:17","modified_gmt":"2022-02-18T15:46:17","slug":"keyword-search-extension","status":"publish","type":"post","link":"https:\/\/www.podfeet.com\/blog\/2022\/02\/keyword-search-extension\/","title":{"rendered":"Easier, Faster Web Searches with Keyword Search Extension for Safari"},"content":{"rendered":"<p>I\u2019m reasonably skilled at searching the web, especially using a little search trick I learned years ago.  Let\u2019s say you want to find the diagram I made for all of the new Pro and Max 14\u201d MacBook Pros. You know it\u2019s somewhere on podfeet.com, and you could navigate there first and then use my search box, but if you\u2019re already at your search engine of choice, there\u2019s a better way.<\/p>\n<p>Simply type your search term(s), followed by the word \u201csite:urlOfSite\u201d as in this example where I&#8217;m going to look for the two words &#8220;diagram&#8221; and &#8220;max&#8221; on podfeet.com:<\/p>\n<p><code>diagram max site:podfeet.com<\/code><\/p>\n<p>This will give you a list of search results on your search engine\u2019s site. In my example,  the first result will be a link to my <a href=\"https:\/\/www.podfeet.com\/blog\/2021\/10\/m1-pro-max-diagram\/\" target=\"_blank\" rel=\"noopener\">blog post containing the diagram to help you choose the right 14\u201d MacBook Pro<\/a>.<\/p>\n<p>If you&#8217;d rather, you can type the &#8220;site:urlOfSite&#8221; first, and follow it with the search term(s).  This will become important later in the story.<\/p>\n<p>I use this method to search sites all the time because it\u2019s 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\u2019s home page? It\u2019s 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!<\/p>\n<p>But on a recent <a href=\"https:\/\/www.relay.fm\/clockwise\" target=\"_blank\" rel=\"noopener\">Clockwise Podcast<\/a>, 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.<\/p>\n<p>I\u2019ll explain how to install and configure the extension in a moment but first, let\u2019s talk about how it solves the same problem but in a more efficient way.<\/p>\n<h4>Why is the Keyword Search Extension Better?<\/h4>\n<p>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\u2019s say you want to search Wikipedia for \u201cwarthog\u201d. With the Keyword Seach Extention, you can simply type into your search bar, \u201cw warthog\u201d and you\u2019ll immediately be directed to Wikipedia open to the warthog page. You don\u2019t have to navigate to Wikipedia after searching, you\u2019re already there. I find that magical.<\/p>\n<p>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&#8217;ll learn how to make your own little keywords for the searches you do often.<\/p>\n<p>By inspecting the Wikipedia example, you&#8217;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 \u201csearch Wikipedia\u201d).<\/p>\n<p>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.<\/p>\n<p>There are two main advantages of the Keyword Search Extension. Firstly, you type fewer characters. Secondly, you are immediately taken to the website you&#8217;re searching instead of having to click again from your search engine to get to the website.  Because we&#8217;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 &#8220;site:wikipedia.com warthog&#8221; on the Mac isn&#8217;t that bad, it&#8217;s a game-changer to type only &#8220;w warthog&#8221; on a tiny iPhone keyboard.<\/p>\n<p>Hopefully, I\u2019ve 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.<\/p>\n<h4>Download the Extension<\/h4>\n<p><a href=\"https:\/\/apps.apple.com\/us\/app\/keyword-search\/id1558453954\" target=\"_blank\" rel=\"noopener\"><\/p>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/02\/Keyword-Search-in-the-Mac-App-Store.png\" alt=\"Keyword Search in the Mac App Store\" title=\"#title#\" width=\"384 \" height=\"299\"><figcaption style=\"text-align:center\">Keyword Search in the Mac App Store<\/figcaption><\/figure>\n<p><\/a>Most people have installed extensions into browsers before, but since extensions on iOS Safari are brand new, I\u2019m going to walk through it in case you haven\u2019t done it before. For completeness sake, I\u2019ll explain it quickly on macOS Safari first.<\/p>\n<p>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 <a href=\"https:\/\/apps.apple.com\/us\/app\/keyword-search\/id1558453954\" target=\"_blank\" rel=\"noopener\">Keyword Search extension<\/a>, or better yet go to the link in the show notes that will take you directly to Keyword Search in the Mac App Store.<\/p>\n<p>Once you\u2019ve 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\u2019s an easy step, but it\u2019s always confusing to me that if I go to the menu and select Safari Extensions, I don\u2019t see <em>my<\/em> extensions, I\u2019m back in the App Store. Ok, enough whining about the App Store.<\/p>\n<p><a href=\"https:\/\/apps.apple.com\/us\/app\/keyword-search\/id1558453954\" target=\"_blank\" rel=\"noopener\"><\/p>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/02\/Keyword-Search-in-iOS-App-Store.jpeg\" alt=\"Keyword Search in iOS App Store\" title=\"#title#\" width=\"350 \" height=\"217\"><figcaption style=\"text-align:center\">Keyword Search in iOS App Store<\/figcaption><\/figure>\n<p><\/a>Switching gears to iOS, again search for Keyword Search in the App Store. Surprisingly, you can also use the <a href=\"https:\/\/apps.apple.com\/us\/app\/keyword-search\/id1558453954\" target=\"_blank\" rel=\"noopener\">same link I gave you to Keyword Search for the Mac<\/a>, but by accessing it from your iPad, iPhone or iPod Touch you\u2019ll get the correct version in the iOS App Store.<\/p>\n<figure style=\"float: left; margin-right: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/02\/Safari-Preferences-Toggle-on-Extenstion.jpeg\" alt=\"Safari Preferences Toggle on Extenstion\" title=\"#title#\" width=\"200 \" height=\"649\"><figcaption style=\"text-align:center\">Toggle On Extension in Safari Settings<\/figcaption><\/figure>\n<p>Once an extension is downloaded to your iOS device, you need to enable it.  Open Settings \u2192 Safari \u2192 Extensions, tap on Keyword Search and toggle it on.  You\u2019ll notice in this same menu, there\u2019s a link to look at more extensions. This will take you into the App Store to discover more extensions, like the <a href=\"https:\/\/apps.apple.com\/us\/app\/1password-password-manager\/id568903335\" target=\"_blank\" rel=\"noopener\">awesome 1Password extension<\/a>.<\/p>\n<p>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.<\/p>\n<h4>How to Configure Keyword Search<\/h4>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/02\/Magnifying-Glass-in-macOS-Safari.png\" alt=\"Magnifying Glass in macOS Safari\" title=\"#title#\" width=\"400 \" height=\"364\"><figcaption style=\"text-align:center\">Magnifying Glass in macOS Safari<\/figcaption><\/figure>\n<p>Once you have Keyword Search installed and activated, on macOS you\u2019ll see a new icon in the toolbar that looks like a little magnifying glass. On iOS, there isn\u2019t 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\u2019ll see the puzzle piece right in the URL field, but if your phone isn\u2019t huge, tap the aA icon to find the puzzle piece where it\u2019s clearly labeled \u201cManage Extensions\u201d.<\/p>\n<p>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.<\/p>\n<p>As I mentioned earlier, when you select Keyword Search in your list of extensions, you\u2019ll see that it\u2019s pre-populated with some common websites to show you how easy it is to configure. For example, you\u2019ll see in the dropdown \u201cAmazon &#8211; sa\u201d.<\/p>\n<p>Let\u2019s break this example down in how it was created. If you tap on the chevron to the right of any of the examples, you\u2019ll see the fields you can fill out to create your own search keywords or modify the ones they\u2019ve 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.<\/p>\n<p>The next field is the keyword(s). You\u2019ll see in the Amazon example that they\u2019ve used \u201csa\u201d to mean \u201csearch Amazon.  You can add additional keywords if you like. Perhaps \u201caz\u201d would be an easy-to-remember keyword for you. Simply separate the keywords with commas and you&#8217;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 &#8220;sp&#8221; is a super short keyword to search my favorite site.<\/p>\n<p>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.<\/p>\n<h4>Expansion Explained<\/h4>\n<p>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\u2019d 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.<\/p>\n<p>The next section is entitled Expansion and that&#8217;s where things get interesting. Expansions are URLs that include the website you want to search, plus what\u2019s called a query string after the URL.  You\u2019ve probably seen query strings but may not have known what they were called. If you\u2019ve ever noticed a question mark followed by more text in a URL, that\u2019s a query string.<\/p>\n<p>The tricky bit here is that websites don\u2019t 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&#8217;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&#8217;ll need for Keyword Search. An example is in order.<\/p>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/02\/Keyword-Search-Small-Steps-Pod-Example.png\" alt=\"Keyword Search Small Steps Pod Example\" title=\"#title#\" width=\"370 \" height=\"539\"><figcaption style=\"text-align:center\">Keyword Search Small Steps Pod Example<\/figcaption><\/figure>\n<p>Let\u2019s say you\u2019re a big fan of the <a href=\"https:\/\/smallstepspod.com\/\" target=\"_blank\" rel=\"noopener\">Start with Small Steps Podcast by Jill from the Northwoods<\/a>.  Navigate to smallstepspod.com and use her search box to search for anything you like. I\u2019ll search for weight loss. In the URL bar I see:<\/p>\n<p><code>https:\/\/smallstepspod.com\/?s=weight+loss<\/code><\/p>\n<p>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&#8217;ll copy in the URL I got back from searching her site, not including &#8220;weight+loss&#8221;, e.g. <code>https:\/\/smallstepspod.com\/?s=<\/code>.  We have to do one more thing here, and that&#8217;s to add a placeholder for the search term, which is &#8220;@@@&#8221;. I know that sounds super clumsy, but when you see it written it&#8217;s not that bad. It&#8217;s one of those things that takes way longer to try to describe clearly than it does to execute.<\/p>\n<p>Smallstepspod.com is a pretty sensible-looking example, so don&#8217;t get intimidated if you see a really weird-looking one. I mentioned that they&#8217;ve prepopulated the extension with the search for eBay and it&#8217;s SUPER weird. Instead of <code>?s=<\/code> like Jill&#8217;s site, eBay&#8217;s search ends with <code>?\\_nkw=<\/code>. I have no idea what that means but it&#8217;s just as easy to copy and paste from a test search as any other site.<\/p>\n<p>I&#8217;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&#8217;t responding. I remembered that Keyword Search used &#8220;down&#8221; as the keyword for <a href=\"https:\/\/downforeveryoneorjustme.com\" target=\"_blank\" rel=\"noopener\">downforeveryoneorjustme.com<\/a>, so I simply typed &#8220;down&#8221; 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 &#8220;gi&#8221; in my search bar followed by what I was looking for and boom, done in one step.<\/p>\n<h4>Workaround for Static Sites<\/h4>\n<p>One of the sites I search often is Bart\u2019s Programming By Stealth show notes. These are at <a href=\"https:\/\/pbs.bartificer.net\" target=\"_blank\" rel=\"noopener\">pbs.bartificer.net<\/a>. Unfortunately, the Keyword Search extension won\u2019t work on his site because it\u2019s what\u2019s called a static site. That means it\u2019s not being generated by a server-side tool like WordPress, so there\u2019s no way to send a query string to it.  It\u2019s actually a set of pages created by GitHub, the version control system used by most programmers.<\/p>\n<p>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\u2019s 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&#8217;ve had to put into WordPress and my database this week!)<\/p>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/02\/Text-Replacement-in-System-Preferences-for-PBS-Show-Notes.png\" alt=\"Text Replacement in System Preferences for PBS Show Notes\" title=\"#title#\" width=\"500 \" height=\"446\"><figcaption style=\"text-align:center\">Text Replacement in System Preferences for PBS Show Notes<\/figcaption><\/figure>\n<p>While I was disappointed that I couldn\u2019t 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.<\/p>\n<p>I took advantage of the text replacement functionality for macOS and iOS to create something like keywords. Remember our trick that if we type \u201csite:\u201d followed immediately by the URL you want to search, you\u2019ll get search results only for the site you requested?<\/p>\n<p>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 \u201csb\u201c with \u201csite:pbs.bartificer.net\u201d.  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 &#8220;sb&#8221; followed by the search term I want.  &#8220;sb&#8221; automatically expands to site:pbs.bartificer.net so the only search results I get are within the PBS show notes.<\/p>\n<p>This is pretty cool, and since text replacements sync over iCloud, I can use this on any of my iOS or macOS devices.  It\u2019s not as cool as the Keyword Search extension though, because it leaves me on my search engine\u2019s home page. If the term I was searching is only mentioned once on a site, then I\u2019d much rather be taken right to the site instead of having to click again to get there.  It\u2019s not terrible, but it\u2019s an extra step, and automation is all about eliminating extra steps.<\/p>\n<h4>Advanced Settings<\/h4>\n<figure style=\"float: right; margin-left: 10px\"><img decoding=\"async\" src=\"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/02\/Keyword-Search-Advanced-Settings.png\" alt=\"Keyword Search Advanced Settings\" title=\"#title#\" width=\"352 \" height=\"408\"><figcaption style=\"text-align:center\">Keyword Search Advanced Settings<\/figcaption><\/figure>\n<p>There\u2019s one part of Keyword Search we should cover.  In Advanced Settings, there are three sections. Remember when I searched for \u201cweight loss\u201d on SmallStepsPod.com? The search query put a \u201c+\u201d sign between \u201cweight\u201d and \u201closs\u201d because URLs don\u2019t work with spaces in them so there must be a separator.<\/p>\n<p>In Keyword Search\u2019s advanced settings for individual sites, it explains that the default is to replace spaces with \u201c+\u201d, 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\u2019s not a \u201c+\u201d, just add the separator you do find to the Space Replacement section under Advanced Settings.<\/p>\n<p>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\u2019re unexpected.<\/p>\n<p>For example, if you use the search box on smallstepspod.com for \u201cweight loss\u201d without quotes around it, you\u2019re likely to find every time Jill talked about \u201cweight\u201d or \u201closs\u201d.  But if you put the search terms into quotes, you narrow down your search to just where she talked about weight loss.<\/p>\n<p>But query strings in URLs can\u2019t 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 \u201cweight loss\u201d in quotes, Keyword Search will replace both of the quotes with <code>%22<\/code> which believe it or not is <a href=\"https:\/\/www.w3schools.com\/tags\/ref\\_urlencode.ASP\" target=\"_blank\" rel=\"noopener\">the official way to encode those pesky spaces in URls<\/a>. If you&#8217;re not sure what I&#8217;m talking about, just leave that checkbox for URL escape checked and move along.<\/p>\n<p>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\u2019ve never come across a circumstance where I\u2019ve needed it.<\/p>\n<p>The final setting under Advanced is interesting. By default, you\u2019re expected to put the keyword first and follow it with the search term, but there\u2019s a dropdown to allow you to put it at the front or end of what you type. This would allow you to type \u201cweight loss ssp\u201d or \u201cssp weight loss\u201d.<\/p>\n<p>If you want to be able to change all sites to allow the search term before the keyword, there\u2019s a global setting you can change as well.<\/p>\n<h4>Bottom Line<\/h4>\n<p>The bottom line is that I&#8217;ve managed to make this sound much more complicated than it actually feels to use it. As I said, if you\u2019re 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.<\/p>\n<p><a href=\"https:\/\/github.com\/arnemart\/SafariKeywordSearch\" target=\"_blank\" rel=\"noopener\">Keyword Search is free and open source (licensed under the Mozilla Public License 2.0)<\/a>, 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019m reasonably skilled at searching the web, especially using a little search trick I learned years ago. Let\u2019s say you want to find the diagram I made for all of the new Pro and Max 14\u201d MacBook Pros. You know it\u2019s somewhere on podfeet.com, and you could navigate there first and then use my search [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":25309,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[147],"tags":[844,5071,5070,5072,49,5073],"class_list":["post-25311","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-posts","tag-extensions","tag-ios-extension","tag-keyword-search","tag-macos-extension","tag-search","tag-search-engine"],"jetpack_featured_media_url":"https:\/\/www.podfeet.com\/blog\/wp-content\/uploads\/2022\/02\/Magnifying-Glass-in-macOS-Safari.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/25311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/comments?post=25311"}],"version-history":[{"count":7,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/25311\/revisions"}],"predecessor-version":[{"id":25320,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/posts\/25311\/revisions\/25320"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/media\/25309"}],"wp:attachment":[{"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/media?parent=25311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/categories?post=25311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.podfeet.com\/blog\/wp-json\/wp\/v2\/tags?post=25311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}