Kieran Hunt

Recipe search engine

✦ 2023-04-13

America's Test Kitchen, bon appétit, David Lebovitz, Epicurious, Food52, NYT Cooking, The Spruce Eats, Woolworths TASTE


Ben Tilden had this clever idea (archive). He created a custom Google search form that limits search results to specific recipe websites. The website list includes sites like New York Times Cooking and Serious Eats.

Ben’s raison d’être for the custom search engine was:

[…] finding good recipes online can be surprisingly hard. One of the main problems is the sheer volume of information available. With so many websites, blogs, and recipe databases to choose from, it can be overwhelming.

And then there’s quality control. Anyone can post a recipe online, regardless of their cooking experience or knowledge. You may—scratch that—you will come across recipes that are poorly written, inaccurate, or just don’t work.

I thought that was a really neat idea but I wanted to make a few changes to Ben’s search engine:

  1. I wanted to add my own recipe websites. Ben’s list is good—it has many of the sites I usually reach for—but there are others I think should be included. Sites I’ve found helpful over the years.
  2. I wanted it to use Duck Duck Go (DDG) for search. There’s no need to give Google everyone’s data unnecessarily.
  3. I wanted to avoid Javascript. DDG is pretty configurable through HTML forms and so why bother with JS? Read below.

Ben used Google’s Programmable Search Engine for his project. It works by configuring a list of sites you want to search and then embedding a Google search box wherever it makes sense on your website. Google lets you set multiple websites in the search list and supports basic wildcarding like *.kieran.casa/*.

Building a custom search engine on DDG turned out to be trickier than expected. DDG allows you to customize a surprisingly large amount of the search experience. Its Params (archive) documentation lists all sorts of settings you can configure using URL query parameters. Did you know that you can turn off advertisements with the k1 param?

Strangely absent from that documentation is the sites parameter. This query parameter clearly exists (click on this search to see: https://duckduckgo.com/?q=test&sites=kieran.casa). And has been mentioned around the web (archive). But at some point in the past lost the ability to filter for multiple different sites. Or maybe it never had it? Anyway, after a good few hours trying to send multiple domains through the sites query parameter I gave up.

So my solution then. As I couldn’t get a pure query parameter-based search form working, I had to resort to using Javascript to append a website filter to the search query. It is certianly not the end of the world, but a bit of a pity nonetheless.

A special thanks to Ben for the original idea and to Pat Dryburgh for his help and handy DuckDuckGo Search Box Generator (archive).