@@ -198,8 +198,10 @@ export default defineConfig({
198198 [ "style" , { } ]
199199 ] ,
200200 async transformHead ( { pageData, head} ) {
201+ let description = pageData . description ;
201202 if ( pageData . filePath === "index.md" ) {
202203 head . push ( ...defaultImageMetaTags ) ;
204+ description ||= defaultPageDescription ;
203205 } else if ( pageData . relativePath === "404.md" )
204206 head . push ( ...defaultImageMetaTags ) ;
205207
@@ -209,7 +211,6 @@ export default defineConfig({
209211 ]
210212 . filter ( Boolean )
211213 . join ( " - " ) || defaultPageTitle ;
212- const description = pageData . description || defaultPageDescription ;
213214
214215 if ( pageData . filePath . startsWith ( "blog/" ) && pageData . frontmatter . image != null ) {
215216 let imageDir = pageData . filePath ;
@@ -249,9 +250,12 @@ export default defineConfig({
249250 }
250251
251252 head . push ( [ "meta" , { name : "og:title" , content : title } ] ) ;
252- head . push ( [ "meta" , { name : "og:description" , content : description } ] ) ;
253+ if ( description != null && description !== "" )
254+ head . push ( [ "meta" , { name : "og:description" , content : description } ] ) ;
255+
253256 head . push ( [ "meta" , { name : "twitter:title" , content : title } ] ) ;
254- head . push ( [ "meta" , { name : "twitter:description" , content : description } ] ) ;
257+ if ( description != null && description !== "" )
258+ head . push ( [ "meta" , { name : "twitter:description" , content : description } ] ) ;
255259 } ,
256260 transformPageData ( pageData ) {
257261 if ( pageData . filePath . startsWith ( "api/" ) ) {
0 commit comments