chore: improve nav active state checking

This commit is contained in:
Cory Dransfeldt 2024-03-18 18:44:35 -07:00
parent 3cff5d47e6
commit f39f5ee2ff
No known key found for this signature in database
3 changed files with 9 additions and 3 deletions

View file

@ -37,6 +37,12 @@ export default {
},
replaceQuotes: (string) => string.replace(/"/g, "'"),
// navigation
isLinkActive: (category, page) => {
const normalizedPage = page.includes('.html') ? page.replace('.html', '/') : page
return !!normalizedPage && normalizedPage.includes(category) && !/\d+/.test(normalizedPage);
},
// analytics
getPopularPosts: (posts, analytics) => {
return posts