Skip to content

Commit

Permalink
Fix feed, fix feed item sorting
Browse files Browse the repository at this point in the history
66c8888 (#1765) added old blog posts but with a current author and commit date.

Blog items should be dated to their creation and publication rather than when this git source move took place.

Because the feed plugin used git dates, only the 30 oldest items ended up in the feed.

Falling back to front-matter date should resolve the issue.

Blog posts showing up correctly dated on `/blog/` indicates that the page date is set correctly from the file name, even without explicit front matter within the post source file.

Untested; please verify.

Hopefully resolves #1767

An alternative approach would be committing the post files individually with git commits dated back to their publication dates. But the whole git integration seems error-prone to me, so this commit seems like a better solution with less effort.
  • Loading branch information
Kissaki committed Feb 1, 2025
1 parent dcdb938 commit 587a039
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions .vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,7 @@ export default defineUserConfig({
);
},
sorter: (a, b) => {
return compareDate(
a.data.git?.createdTime
? new Date(a.data.git?.createdTime)
: a.frontmatter.date,
b.data.git?.createdTime
? new Date(b.data.git?.createdTime)
: b.frontmatter.date,
);
return compareDate(a.frontmatter.date, b.frontmatter.date);
},
}),
sitemapPlugin({
Expand Down

0 comments on commit 587a039

Please sign in to comment.