trying workaround

This commit is contained in:
Firq 2023-03-04 22:35:49 +01:00
parent e954be1e08
commit e1420a15fc
Signed by: Firq
GPG key ID: 3ACC61C8CEC83C20
5 changed files with 13 additions and 8 deletions
src/components

View file

@ -9,16 +9,19 @@ export interface Props {
const {icon, text, link, currentPage } = Astro.props;
let currPage = "";
const slug = link.replace(new RegExp('/', 'g'), "")
if (currentPage === link.replace(new RegExp('/', 'g'), "")) {
if (currentPage === slug) {
currPage = "current"
} else if (currentPage === "home" && link === "/") {
currPage = "current"
}
const fulllink = `${Astro.site}/${slug}`;
---
<li>
<a href={link} rel="noopener noreferrer" aria-label={text} class={currPage}>
<a href={fulllink} rel="noopener noreferrer" aria-label={text} class={currPage}>
<i class={icon}></i>
{text}
</a>