Added OG support
This commit is contained in:
@@ -20,12 +20,27 @@ export type PageMetadata = {
|
||||
description?: string
|
||||
images?: { url: string }[]
|
||||
locale?: string
|
||||
/** Site/brand name for the OG card. */
|
||||
siteName?: string
|
||||
title: string
|
||||
/** 'website' | 'article' etc. Defaults to 'website'. */
|
||||
type?: string
|
||||
/** Canonical URL of this page. */
|
||||
url?: string
|
||||
}
|
||||
/** robots directives — set to noindex/follow for legal/thin/search pages. */
|
||||
/**
|
||||
* robots directives. Indexed pages get generous snippet/preview limits by
|
||||
* default (Google shows richer results); noindex pages get index:false.
|
||||
*/
|
||||
robots?: {
|
||||
follow: boolean
|
||||
index: boolean
|
||||
/** 'none' | 'standard' | 'large' — image preview size in results. */
|
||||
'max-image-preview'?: 'large' | 'none' | 'standard'
|
||||
/** Max text snippet length; -1 = no limit. Next maps to max-snippet. */
|
||||
'max-snippet'?: number
|
||||
/** Max video preview seconds; -1 = no limit. */
|
||||
'max-video-preview'?: number
|
||||
}
|
||||
title: string
|
||||
}
|
||||
@@ -140,10 +155,24 @@ export function buildMetadata({
|
||||
title,
|
||||
...(description && { description }),
|
||||
...(images && { images }),
|
||||
type: 'website',
|
||||
locale,
|
||||
...(siteName ? { siteName } : {}),
|
||||
...(canonical ? { url: canonical } : {}),
|
||||
},
|
||||
// noindex → tell search engines to exclude the page but still follow links
|
||||
// (authority flows through). For legal/thin/search-result pages.
|
||||
...(meta?.noindex ? { robots: { follow: true, index: false } } : {}),
|
||||
// robots: noindex pages are excluded (follow keeps link authority). Indexed
|
||||
// pages get generous snippet/preview limits so Google can show rich results
|
||||
// (long snippets, large image previews, full video previews).
|
||||
...(meta?.noindex
|
||||
? { robots: { follow: true, index: false } }
|
||||
: {
|
||||
robots: {
|
||||
follow: true,
|
||||
index: true,
|
||||
'max-image-preview': 'large' as const,
|
||||
'max-snippet': -1,
|
||||
'max-video-preview': -1,
|
||||
},
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user