UNPKG

@forge42/seo-tools

Version:

Framework agnostic set of helpers designed to help you create, maintain and develop your SEO

79 lines (77 loc) 2.25 kB
type MetaDescriptor = { charSet: "utf-8"; } | { title: string; } | { name: string; content: string; } | { property: string; content: string; } | { httpEquiv: string; content: string; } | { "script:ld+json": LdJsonObject; } | { tagName: "meta" | "link"; [name: string]: string; } | { [name: string]: unknown; }; type LdJsonObject = { [Key in string]: LdJsonValue; } & { [Key in string]?: LdJsonValue | undefined; }; type LdJsonArray = LdJsonValue[] | readonly LdJsonValue[]; type LdJsonPrimitive = string | number | boolean | null; type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray; interface MetaData { /** * The title of the page. * this will be used as the title of the page and in the meta tags. * this also generates the twitter:title and og:title meta tags. */ title: string; /** * The description of the page. * this will be used as the description of the page and in the meta tags. * this also generates the twitter:description and og:description meta tags. */ description: string; /** * The url of the page. * this generates the og:url meta tag. */ url: string; /** * The image of the page. * this generates the og:image meta tag. */ image?: string; /** * The site name of the page. * this generates the og:site_name meta tag. */ siteName?: string; /** * The twitter card type of the page. * this generates the twitter:card meta tag. * this is optional and will default to "summary_large_image". * @default "summary_large_image" */ twitterCard?: string; } /** * Generate meta tags for Remix to be consumed by the meta function. * * The first argument takes common meta tags like title, description, url, siteName, image, and keywords. * Then it generates meta tags for Twitter and Open Graph using the same data. * * @param metaData - MetaData object * @param additionalData - Additional meta tags * @returns MetaDescriptor[] - Remix compatible meta tags */ declare const generateMeta: (metaData: MetaData, additionalData?: MetaDescriptor[]) => MetaDescriptor[]; export { type MetaData, generateMeta };