@@ -731,19 +731,26 @@ export default defineConfig({
731731 return bDate . getTime ( ) - aDate . getTime ( ) ;
732732 } ) ;
733733
734- for ( const { url, excerpt , frontmatter, html} of blogPosts ) {
734+ for ( const { url, frontmatter, html, src , excerpt : originalExcerpt } of blogPosts ) {
735735 const ogImageElement = findElementInHtml ( html , ( element ) => element . tagName === "meta" && element . properties ?. name === "og:image" ) ;
736736 const date = new Date ( frontmatter . date ) ;
737737 if ( Number . isNaN ( date . getTime ( ) ) )
738738 throw new Error ( `Invalid date for blog post: ${ url } ` ) ;
739739 else if ( frontmatter . title == null || frontmatter . title === "" )
740740 throw new Error ( `Invalid title for blog post: ${ url } ` ) ;
741741
742+ let description : string | undefined = frontmatter . description ;
743+ if ( ( description == null || description == "" ) && src != null )
744+ description = await getExcerptFromMarkdownFile ( src ) ;
745+
746+ if ( ( description == null || description === "" ) && originalExcerpt != null && originalExcerpt !== "" )
747+ description = originalExcerpt ;
748+
742749 feed . addItem ( {
743750 title : frontmatter . title ,
744751 id : resolveHref ( url , true ) ,
745752 link : resolveHref ( url , true ) ,
746- description : excerpt || frontmatter . description || undefined ,
753+ description,
747754 content : html ,
748755 author : [ {
749756 name : frontmatter . author ?. name ,
0 commit comments