trying workaround
This commit is contained in:
parent
e954be1e08
commit
e1420a15fc
5 changed files with 13 additions and 8 deletions
src/components
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue