File tree Expand file tree Collapse file tree 4 files changed +8
-21
lines changed
Expand file tree Collapse file tree 4 files changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export interface PostData {
1212 date : string | null ;
1313 content : string ;
1414 excerpt ?: string ;
15+ thumbnail ?: string ;
1516}
1617
1718export function getAllPosts ( ) : PostData [ ] {
@@ -53,6 +54,7 @@ export function getAllPosts(): PostData[] {
5354 date : data . date || null ,
5455 content,
5556 excerpt : data . excerpt || cleanContent . slice ( 0 , 160 ) + '...' ,
57+ thumbnail : typeof data . thumbnail === 'string' ? data . thumbnail : undefined ,
5658 } ) ;
5759 }
5860 }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -42,10 +42,14 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
4242 publishedTime : post . date || undefined ,
4343 images : [
4444 {
45- url : '/og-default.svg' ,
45+ url : post . thumbnail
46+ ? post . thumbnail . startsWith ( 'http' ) || post . thumbnail . startsWith ( '/' )
47+ ? post . thumbnail
48+ : `/posts/${ post . relativeDir ? post . relativeDir + '/' : '' } ${ post . thumbnail } `
49+ : '/og-default.png' ,
4650 width : 1200 ,
4751 height : 630 ,
48- alt : 'FE Lab Blog - Frontend Experimentation' ,
52+ alt : post . title ,
4953 } ,
5054 ] ,
5155 } ,
You can’t perform that action at this time.
0 commit comments