diff --git a/project-words.txt b/project-words.txt index 141346e..0893b85 100644 --- a/project-words.txt +++ b/project-words.txt @@ -16,6 +16,7 @@ Dechorionator ebox fhhs flowbite +Gitea HDFS headshot Homelab diff --git a/src/components/Footer.astro b/src/components/Footer.astro index b9d1939..af98c0e 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,10 +1,23 @@ --- +import InlineLink from "@components/InlineLink.astro"; +const { pathname } = Astro.url; --- diff --git a/src/components/InlineLink.astro b/src/components/InlineLink.astro index a302e00..93f5428 100644 --- a/src/components/InlineLink.astro +++ b/src/components/InlineLink.astro @@ -7,16 +7,10 @@ interface Props extends ComponentPropsBase { } const { class: className, href, target } = Astro.props; +const { pathname } = Astro.url; -let finalTarget: string | undefined = target; - -if (target === undefined) { - if (href.startsWith("/")) { - finalTarget = ""; - } else { - finalTarget = "_blank"; - } -} +const finalTarget = + target === undefined ? (href.startsWith("/") ? undefined : "_blank") : target; --- <> @@ -24,6 +18,7 @@ if (target === undefined) { class:list={["text-blue-500", "hover:text-blue-300", className]} href={href} target={finalTarget} + aria-current={pathname === href ? "page" : undefined} > diff --git a/src/components/NestedNavbarEntries.astro b/src/components/NestedNavbarEntries.astro index 0a4c0c4..30b94e5 100644 --- a/src/components/NestedNavbarEntries.astro +++ b/src/components/NestedNavbarEntries.astro @@ -1,20 +1,12 @@ --- import type { navLink } from "@interfaces/site-layout.ts"; +import { getHrefPath, getNavLinkSuffix } from "@data/site-layout.ts"; + const items: navLink[] = Astro.props.items; const depth: number = Astro.props.depth ?? 0; const paths: string[] = Astro.props.paths ?? []; -const getNavLinkSuffix = (entry: navLink): string => { - return "-" + [...paths, entry.path].join("-"); -}; -const getHrefPath = (entry: navLink): string => { - return entry.pubpath - ? entry.pubpath - : "/" + - (paths && paths.length ? [...paths, entry.path].join("/") : entry.path); -}; - const { pathname } = Astro.url; --- @@ -29,21 +21,22 @@ const { pathname } = Astro.url; { items.map( (entry) => - (entry.enabled ?? true) && ( + (entry.enabled ?? true) && + !(entry.hidden ?? false) && (
  • {Array.isArray(entry.children) && entry.children.length ? (