Skip to content

Commit 763f30a

Browse files
committed
Load the Website home directly from the docs mark
The mark's link leaves the docs' client router, so a router fetch before the full page load was wasted. Fail the build if the configured logo stops resolving to an inline SVG instead of shipping a header without its mark.
1 parent 2e8b6fd commit 763f30a

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

‎components/Logo.astro‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
// to the Docs home. Docs are always served inside the Website artifact at
44
// /docs, so the configured root-relative `logo.href` ("/") is emitted as is,
55
// without the deployment base, and reaches the Website home on whatever origin
6-
// serves the page.
6+
// serves the page. The Website is not part of the Docs' client router, so the
7+
// mark's link does a plain page load instead of a router fetch first.
78
import { withBase } from "blume/components/islands/base-path.ts";
89
import type { BlumeLogo } from "blume/core/data.ts";
910
@@ -16,16 +17,20 @@ interface Props {
1617
const { site, logo } = Astro.props;
1718
const label = logo?.text ?? site.title;
1819
const link = "inline-flex items-center transition-opacity hover:opacity-80";
20+
// The config inlines the wordmark so it follows the theme. Fail the build
21+
// rather than ship a header whose mark silently disappeared.
22+
if (!logo?.svg) throw new Error("components/Logo.astro needs blume.config.ts `logo` to resolve to an inline SVG.");
1923
---
2024

2125
<div class="flex min-w-0 items-center gap-2" data-sf-brand>
22-
{
23-
logo?.svg && (
24-
<a aria-label={`${logo.alt || "Spacefast"} home`} class:list={[link, "shrink-0 text-foreground"]} href={logo.href}>
25-
<span aria-hidden="true" class="inline-flex h-5 items-center [&>svg]:h-5 [&>svg]:w-auto" set:html={logo.svg} />
26-
</a>
27-
)
28-
}
26+
<a
27+
aria-label={`${logo.alt || "Spacefast"} home`}
28+
class:list={[link, "shrink-0 text-foreground"]}
29+
data-astro-reload
30+
href={logo.href}
31+
>
32+
<span aria-hidden="true" class="inline-flex h-5 items-center [&>svg]:h-5 [&>svg]:w-auto" set:html={logo.svg} />
33+
</a>
2934
{
3035
label && (
3136
<a class:list={[link, "min-w-0 font-semibold text-base text-foreground"]} href={withBase("/")}>

0 commit comments

Comments
 (0)