Skip to content
HomePagesHomePages template kit

LinkProvider

One entry in `LINK_PROVIDERS` — how to recognize a pasted URL as belonging to a specific provider, and what kind of link it is.

One entry in LINK_PROVIDERS — how to recognize a pasted URL as belonging to a specific provider, and what kind of link it is.

Import from @homepages/template-kit.

export interface LinkProvider {
kind: LinkKind;
label: string;
pattern: RegExp;
path?: RegExp;
strategy: LinkStrategy;
}
  • pattern tests the parsed URL’s HOSTNAME, never the raw string — a path segment naming a host must not classify as that host. path, when present, additionally tests the pathname: maps needs it because drive.google.com and www.google.com/maps share no distinguishing host.