fix(header.liquid): set header link active state properly
This commit is contained in:
parent
d13984f114
commit
0c64cdf570
4 changed files with 15 additions and 6 deletions
|
@ -1,4 +1,12 @@
|
|||
const normalizeUrl = (url) =>
|
||||
url.replace(/index\.php$|index\.html$/i, '').replace(/\.php$|\.html$/i, '') || '/';
|
||||
|
||||
export default {
|
||||
isLinkActive: (category, page) =>
|
||||
page.includes(category) && page.split('/').filter((a) => a !== '').length <= 1
|
||||
isLinkActive: (category, page) => {
|
||||
const normalized = normalizeUrl(page);
|
||||
return (
|
||||
normalized.includes(category) && normalized.split('/').filter((a) => a !== '').length <= 1
|
||||
);
|
||||
},
|
||||
normalizeUrl
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue