diff --git a/src/SEO.astro b/src/SEO.astro index 3a30114..8ec5b21 100644 --- a/src/SEO.astro +++ b/src/SEO.astro @@ -37,6 +37,14 @@ export interface Props { width?: number; height?: number; alt?: string; + }, + article?: { + publishedTime?: string; + modifiedTime?: string; + expirationTime?: string; + authors?: string[]; + section?: string; + tags?: string[]; } }, twitter?: { @@ -111,6 +119,46 @@ function generateOpenGraphImageTags(props: Props) { } } +function generateOpenGraphArticleTags(props: Props) { + if (props.openGraph?.article) { + const { + publishedTime, + modifiedTime, + expirationTime, + authors, + section, + tags + } = props.openGraph.article; + + return ( + + { publishedTime ? ( + + ) : null} + { modifiedTime ? ( + + ) : null} + { expirationTime ? ( + + ) : null} + { authors ? ( + authors.map((author) => ( + + )) + ) : null} + { section ? ( + + ) : null} + { tags ? ( + tags.map((tag) => ( + + )) + ) : null} + + ) + } +} + function generateTwitterTags(props: Props) { if (props.twitter) { const { @@ -192,4 +240,6 @@ function generateTwitterTags(props: Props) { ) : null } {generateOpenGraphImageTags(props)} +{generateOpenGraphArticleTags(props)} {generateTwitterTags(props)} +