File tree Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -250,14 +250,27 @@ export default defineUserConfig({
250
250
) ;
251
251
} ,
252
252
sorter : ( a , b ) => {
253
- return compareDate (
254
- a . data . git ?. createdTime
255
- ? new Date ( a . data . git ?. createdTime )
256
- : a . frontmatter . date ,
257
- b . data . git ?. createdTime
258
- ? new Date ( b . data . git ?. createdTime )
259
- : b . frontmatter . date ,
253
+ const pathDateA = new Date (
254
+ a . path . replace ( '/blog/' , '' ) . substring ( 0 , 10 ) ,
260
255
) ;
256
+ const pathDateB = new Date (
257
+ b . path . replace ( '/blog/' , '' ) . substring ( 0 , 10 ) ,
258
+ ) ;
259
+ const effectiveDateA =
260
+ pathDateA != 'Invalid Date'
261
+ ? pathDateA
262
+ : a . frontmatter . date
263
+ ? new Date ( a . frontmatter . date )
264
+ : new Date ( a . data . git ?. createdTime ) ;
265
+
266
+ // Determine the effective date for item B
267
+ const effectiveDateB =
268
+ pathDateB != 'Invalid Date'
269
+ ? pathDateB
270
+ : b . frontmatter . date
271
+ ? new Date ( b . frontmatter . date )
272
+ : new Date ( b . data . git ?. createdTime ) ;
273
+ return compareDate ( effectiveDateA , effectiveDateB ) ;
261
274
} ,
262
275
} ) ,
263
276
sitemapPlugin ( {
You can’t perform that action at this time.
0 commit comments