Customize search engines

2025年1月18日

In Firefox, go to about:config, add key browser.urlbar.update2.engineAliasRefresh to true. Otherwise you can’t manually add search engines or rules.

Search engine name shortcut URL
CPP reference cpp https://duckduckgo.com/?sites=cppreference.com&q=%s&ia=web
git-scm git https://git-scm.com/search/results?search=git-%s
UBuntu Manpages m https://manpages.ubuntu.com/cgi-bin/search.py?q=%s

Incorporate the section into C:\Program Files\Mozilla Firefox\distribution\policies.json.

{
  "policies": {
    "SearchEngines": {
      "Add": [
        {
          "Name": "Example1",
          "URLTemplate": "https://www.example.org/q={searchTerms}",
          "Method": "GET" | "POST",
          "IconURL": "https://www.example.org/favicon.ico",
          "Alias": "example",
          "Description": "Description",
          "PostData": "name=value&q={searchTerms}",
          "SuggestURLTemplate": "https://www.example.org/suggestions/q={searchTerms}"
        }
      ]
    }
  }
}

https://mozilla.github.io/policy-templates/#searchengines–add

Then, when you type for example cpp “std:string” in the address bar, the browser will search cppreference.com for std::string.