diff options
-rw-r--r-- | src/components/Header.astro | 2 | ||||
-rw-r--r-- | src/components/HeaderLink.astro | 32 | ||||
-rw-r--r-- | src/pages/blog/[event]/index.astro | 2 | ||||
-rw-r--r-- | src/pages/blog/index.astro | 2 |
4 files changed, 21 insertions, 17 deletions
diff --git a/src/components/Header.astro b/src/components/Header.astro index c9ab99f..8d01e09 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -5,7 +5,7 @@ import { SITE_TITLE } from '../consts'; <header> <nav> - <h2><a href="/">{SITE_TITLE}</a></h2> + <h2><a href="/astro-blog">{SITE_TITLE}</a></h2> <div class="internal-links"> <HeaderLink href="/">Home</HeaderLink> <HeaderLink href="/blog">Blog</HeaderLink> diff --git a/src/components/HeaderLink.astro b/src/components/HeaderLink.astro index 41da846..b98a39e 100644 --- a/src/components/HeaderLink.astro +++ b/src/components/HeaderLink.astro @@ -1,24 +1,28 @@ --- -import type { HTMLAttributes } from 'astro/types'; +import type { HTMLAttributes } from "astro/types"; -type Props = HTMLAttributes<'a'>; +type Props = HTMLAttributes<"a">; const { href, class: className, ...props } = Astro.props; -const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, ''); +const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, ""); const subpath = pathname.match(/[^\/]+/g); -const isActive = href === pathname || href === '/' + (subpath?.[0] || ''); +const isActive = href === pathname || href === "/" + (subpath?.[0] || ""); --- -<a href={href} class:list={[className, { active: isActive }]} {...props}> - <slot /> +<a + href={"/base/" + href} + class:list={[className, { active: isActive }]} + {...props} +> + <slot /> </a> <style> - a { - display: inline-block; - text-decoration: none; - } - a.active { - font-weight: bolder; - text-decoration: underline; - } + a { + display: inline-block; + text-decoration: none; + } + a.active { + font-weight: bolder; + text-decoration: underline; + } </style> diff --git a/src/pages/blog/[event]/index.astro b/src/pages/blog/[event]/index.astro index 5bab8f0..46e2557 100644 --- a/src/pages/blog/[event]/index.astro +++ b/src/pages/blog/[event]/index.astro @@ -112,7 +112,7 @@ const posts = blogs { posts.map((post) => ( <li> - <a href={`/blog/${post.id}`}> + <a href={`/astro-blog/blog/${post.id}`}> <h4 class="title">{post.data.title}</h4> </a> </li> diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 07cc838..7f1f01e 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -106,7 +106,7 @@ console.log(events); { events.map((event) => ( <li> - <a href={`/blog/${event}/`}> + <a href={`/astro-blog/blog/${event}/`}> <h4 class="title">{event}</h4> </a> </li> |