Skip to content

Commit 3afba97

Browse files
Sync branding assets and use new site logo
Replaces the text-based header brand with a reusable `SiteLogo` component that switches light/dark logo variants. Updates metadata to use `og-default.png` and adds organization logo URLs in structured data for richer SEO output. The content prep script now syncs logo assets from `docs/images/logo` into `public/brand`, app icons, and default OG image, with generated brand/icon files ignored in git.
1 parent 4fc9a79 commit 3afba97

8 files changed

Lines changed: 86 additions & 10 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
/content/docs
2323
/.source
2424
/lib/navigation-data.ts
25+
/public/brand/
26+
/public/og-default.png
27+
/app/favicon.ico
28+
/app/icon.png
29+
/app/apple-icon.png
2530

2631
# Misc
2732
.DS_Store

app/favicon.ico

-14.7 KB
Binary file not shown.

components/site-header.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import Link from "next/link";
44
import { ThemeSwitch } from "fumadocs-ui/layouts/shared/slots/theme-switch";
55
import { GitHubIcon } from "@/components/github-icon";
6+
import { SiteLogo } from "@/components/site-logo";
67
import { buttonVariants } from "@/components/ui/button";
78
import { siteConfig } from "@/content/homepage";
89
import { siteHeaderNav } from "@/lib/navigation";
@@ -14,9 +15,10 @@ export function SiteHeader() {
1415
<div className="mx-auto flex h-14 max-w-6xl items-center justify-between gap-4 px-4 sm:px-6">
1516
<Link
1617
href="/"
17-
className="text-lg font-semibold tracking-tight text-foreground"
18+
className="flex items-center"
19+
aria-label={siteConfig.name}
1820
>
19-
{siteConfig.name}
21+
<SiteLogo />
2022
</Link>
2123
<nav className="hidden items-center gap-6 md:flex">
2224
{siteHeaderNav.map((item) => (

components/site-logo.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { siteConfig } from "@/content/homepage";
2+
import { cn } from "@/lib/utils";
3+
4+
type SiteLogoProps = {
5+
className?: string;
6+
};
7+
8+
export function SiteLogo({ className }: SiteLogoProps) {
9+
return (
10+
<>
11+
<img
12+
src="/brand/logo.svg"
13+
alt={siteConfig.name}
14+
width={32}
15+
height={32}
16+
className={cn("h-8 w-8 dark:hidden", className)}
17+
/>
18+
<img
19+
src="/brand/logo-dark.svg"
20+
alt={siteConfig.name}
21+
width={32}
22+
height={32}
23+
className={cn("hidden h-8 w-8 dark:block", className)}
24+
/>
25+
</>
26+
);
27+
}

lib/page-metadata.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Metadata } from "next";
22
import { siteConfig } from "@/content/homepage";
33

4-
export const DEFAULT_OG_IMAGE = "/og-default.svg";
4+
export const DEFAULT_OG_IMAGE = "/og-default.png";
55

66
export function pageUrl(path: string): string {
77
const normalized = path.startsWith("/") ? path : `/${path}`;

lib/structured-data.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { siteConfig } from "@/content/homepage";
22
import { pageUrl } from "@/lib/page-metadata";
33

4+
export const ORGANIZATION_LOGO = `${siteConfig.url}/brand/icon-512.png`;
5+
46
type Breadcrumb = { label: string; href?: string };
57

68
const FAQ_ENTRIES = [
@@ -47,6 +49,7 @@ export function websiteSchemas() {
4749
name: siteConfig.name,
4850
url: siteConfig.url,
4951
email: siteConfig.email,
52+
logo: ORGANIZATION_LOGO,
5053
sameAs: [siteConfig.githubUrl],
5154
},
5255
{
@@ -87,6 +90,7 @@ export function docArticleSchema({
8790
"@type": "Organization",
8891
name: siteConfig.name,
8992
url: siteConfig.url,
93+
logo: ORGANIZATION_LOGO,
9094
},
9195
...(modifiedTime ? { dateModified: modifiedTime } : {}),
9296
};

public/og-default.svg

Lines changed: 0 additions & 7 deletions
This file was deleted.

scripts/prepare-content.mjs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,48 @@ if (fs.existsSync(imagesSrc)) {
6363
} else {
6464
fs.mkdirSync(imagesDest, { recursive: true });
6565
}
66+
67+
const logoSrc = path.join(imagesSrc, "logo");
68+
const brandDest = path.join(websiteRoot, "public", "brand");
69+
const appDir = path.join(websiteRoot, "app");
70+
71+
function syncLogoAssets() {
72+
if (!fs.existsSync(logoSrc)) {
73+
console.warn("Logo folder not found at:", logoSrc);
74+
return;
75+
}
76+
77+
fs.rmSync(brandDest, { recursive: true, force: true });
78+
fs.mkdirSync(brandDest, { recursive: true });
79+
80+
for (const file of fs.readdirSync(logoSrc)) {
81+
const srcPath = path.join(logoSrc, file);
82+
if (!fs.statSync(srcPath).isFile()) continue;
83+
if (!/\.(svg|png|jpe?g|webp|ico)$/i.test(file)) continue;
84+
fs.copyFileSync(srcPath, path.join(brandDest, file));
85+
}
86+
87+
const faviconSrc = path.join(logoSrc, "favicon.ico");
88+
if (fs.existsSync(faviconSrc)) {
89+
fs.copyFileSync(faviconSrc, path.join(appDir, "favicon.ico"));
90+
}
91+
92+
const icon512Src = path.join(logoSrc, "icon-512.png");
93+
if (fs.existsSync(icon512Src)) {
94+
fs.copyFileSync(icon512Src, path.join(appDir, "icon.png"));
95+
}
96+
97+
const appleIconSrc = path.join(logoSrc, "apple-icon.png");
98+
if (fs.existsSync(appleIconSrc)) {
99+
fs.copyFileSync(appleIconSrc, path.join(appDir, "apple-icon.png"));
100+
}
101+
102+
const ogSrc = path.join(logoSrc, "og-default.png");
103+
if (fs.existsSync(ogSrc)) {
104+
fs.copyFileSync(ogSrc, path.join(websiteRoot, "public", "og-default.png"));
105+
}
106+
107+
console.log("Synced docs/images/logo → public/brand + app icons");
108+
}
109+
110+
syncLogoAssets();

0 commit comments

Comments
 (0)