chore: analytics + deps

This commit is contained in:
Cory Dransfeldt 2024-06-06 09:20:21 -07:00
parent 4ae4a7416e
commit bf6d4f446b
No known key found for this signature in database
14 changed files with 55 additions and 54 deletions

View file

@ -107,10 +107,10 @@ export const popularPosts = (collection) => {
return posts
.filter((post) => {
if (analytics.find((p) => p.url.includes(post.slug))) return true
if (analytics.find((p) => p.page.includes(post.slug))) return true
})
.sort((a, b) => {
const visitors = (page) => analytics.filter((p) => p.url.includes(page.slug)).pop()?.value
const visitors = (page) => analytics.filter((p) => p.page.includes(page.slug)).pop()?.visitors
return visitors(b) - visitors(a)
})
}