const SEARCH_SHORTCUTS = [
{keyword: "@amazon", shortURL: "amazon", url: "https://amazon.com"},
{keyword: "@google", shortURL: "google", url: "https://google.com"}
];
Search shortcuts should be matched based on a given link's .hostname
property, which represents a shortened form of the hostname without the TLD and proceeding www.
(sorry, misleading name. See ShortURL.jsm.
e.g. for a link {url: "https://www.google.com/foo"}
the hostname is google
.
i.e. for the above SEARCH_SHORTCUTS
, the check link.hostname === shortcut.shortURL
is sufficient to check for a match.
The form of a shortcut link produced by TopSitesFeed, requires the following fields, where shortcut
is a search shortcut from the above SEARCH_SHORTCUTS
:
{
searchTopSite: true,
// This is needed in order for tippy top to return the correct URL
// in TippyTopProvider.processSite, as well as for blocking
url: shortcut.url,
label: shortcut.keyword
}