From 649b596c7cb21db769ec4778bbd34aa4e3658bfc Mon Sep 17 00:00:00 2001 From: Corwin Perren Date: Wed, 10 Dec 2025 16:59:54 -0800 Subject: [PATCH] Added this website as content to hobbies, refactored some items into site-layout --- project-words.txt | 1 + src/components/Footer.astro | 13 +++ src/components/InlineLink.astro | 13 +-- src/components/NestedNavbarEntries.astro | 33 +++--- src/components/PopoverWordDefinition.astro | 1 + src/components/Ul.astro | 6 +- src/data/site-layout.ts | 12 +++ src/interfaces/site-layout.ts | 1 + src/pages/hobby/this-website.astro | 120 +++++++++++++++++++++ 9 files changed, 171 insertions(+), 29 deletions(-) create mode 100644 src/pages/hobby/this-website.astro 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 ? (