Skip to content

Commit b143c9b

Browse files
committed
feat: add support for additional metadata options and implement JSON-LD schema generation
1 parent bf28a5f commit b143c9b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/utils.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type MetadataOptions = {
1515
description: string;
1616
siteName?: string;
1717
image?: string;
18+
other?: any;
1819
};
1920
};
2021

@@ -34,6 +35,7 @@ export function generatePageMetadata(options: MetadataOptions = {}): Metadata {
3435
siteName: options.openGraph?.siteName,
3536
images: options.openGraph?.image,
3637
},
38+
other: options.openGraph?.other,
3739
twitter: {
3840
card: 'summary_large_image',
3941
title: options.openGraph?.title,
@@ -46,6 +48,18 @@ export function generatePageMetadata(options: MetadataOptions = {}): Metadata {
4648
}
4749

4850

51+
export interface JsonLdSchema {
52+
'@context': 'https://schema.org';
53+
'@type': string;
54+
[key: string]: any;
55+
}
56+
57+
export function generateJsonLd(schema: JsonLdSchema): string {
58+
return JSON.stringify(schema, null, 2);
59+
}
60+
61+
62+
4963
export function cn(...inputs: ClassNameValue[]) {
5064
return twMerge(inputs);
5165
}

0 commit comments

Comments
 (0)