Skip to content
HomePagesHomePages template kit

matchLinkProvider

Classify a pasted URL against `LINK_PROVIDERS`.

Classify a pasted URL against LINK_PROVIDERS.

Import from @homepages/template-kit.

function matchLinkProvider(url: string): LinkProviderId | null
Name Type Required Description
url string required

"matterport" | "biganto" | "youtube" | "vimeo" | "zillow" | "redfin" | "dropbox" | "drive" | "maps" | nullnull for an unparseable value, a scheme-less value (callers must normalize a bare host by prepending https:// before calling), or a host matching no provider. Otherwise the FIRST match in LINK_PROVIDERS declaration order — load-bearing, since drive.google.com matches both drive’s own pattern and maps’s google.com pattern, and only drive’s earlier declaration makes it resolve to drive rather than maps.