Added OG support

This commit is contained in:
2026-09-28 19:44:28 +02:00
parent cf6feefebc
commit 105c454d73
5 changed files with 95 additions and 10 deletions
+16 -1
View File
@@ -17,12 +17,27 @@ export type PageMetadata = {
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;
};
+20 -4
View File
@@ -71,16 +71,32 @@ import { buildHreflangAlternates } from './hreflang.js';
...images && {
images
},
locale
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.
// 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',
'max-snippet': -1,
'max-video-preview': -1
}
}
};
}
File diff suppressed because one or more lines are too long