matchLinkProvider
Classify a pasted URL against `LINK_PROVIDERS`.
Classify a pasted URL against LINK_PROVIDERS.
Import from @homepages/template-kit.
Signature
Section titled “Signature”function matchLinkProvider(url: string): LinkProviderId | nullParameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
url |
string |
required |
Returns
Section titled “Returns”"matterport" | "biganto" | "youtube" | "vimeo" | "zillow" | "redfin" | "dropbox" | "drive" | "maps" | null — null 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.
See also
Section titled “See also”acceptsLinkcollectionForSlotisLinkAcceptstourEmbedUrlvideoEmbedUrlCOLLECTIONSCONTENT_SLOT_TYPESDECISION_TYPESLINK_KINDSLINK_PROVIDERSLINK_STRATEGIESREF_SLOT_TYPESREFERRAL_FIELDSREFERRAL_IMAGE_FIELDSSLOT_TYPESSOURCE_FIELDSVIDEO_SOURCESLinkProviderCollectionFieldCollectionIdKeyCollectionOwnershipContentSlotTypeDecisionTypeLinkKindLinkProviderIdLinkStrategyReferralFieldReferralImageFieldRefSlotTypeSlotTypeSourceFieldContainerSourceFieldDescriptorSourceFieldNameSourceFieldValueTypeVideoSourceWritebackTarget