diff --git a/src/app/api/og/[...path]/route.tsx b/src/app/api/og/[...path]/route.tsx index 6f4e5172d..baed7c958 100644 --- a/src/app/api/og/[...path]/route.tsx +++ b/src/app/api/og/[...path]/route.tsx @@ -39,7 +39,7 @@ export async function GET( const [polySansFont, logoSvg] = await Promise.all([ readFile(join(process.cwd(), 'src/fonts/PolySans-Neutral.woff')), - readFile(join(process.cwd(), 'public/logo-theme-dark.svg'), 'utf-8') + readFile(join(process.cwd(), 'src/images/logo-theme-dark.svg'), 'utf-8') ]); const logoDataUrl = `data:image/svg+xml,${encodeURIComponent(logoSvg)}`; diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index ee035ba5a..0a93fa47c 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -60,7 +60,7 @@ function Header() { aria-label="Home page" className="relative z-10 hidden md:block" > - + ) { - const basePath = process.env.NEXT_PUBLIC_DOCS_BASE_PATH || ''; +import Image from 'next/image'; +// Imported, not served from `public/`, so the files get content-hashed +// `/_next/static/media/` URLs that the CDN caches immutably. +import logoDark from '@/images/logo-theme-dark.svg'; +import logoLight from '@/images/logo-theme-light.svg'; + +export function Logo() { return ( <> - {/* eslint-disable-next-line @next/next/no-img-element -- SVG logos do not need image optimization. */} - Sourcegraph Docs - {/* eslint-disable-next-line @next/next/no-img-element -- SVG logos do not need image optimization. */} - Sourcegraph Docs ); diff --git a/public/logo-theme-dark.svg b/src/images/logo-theme-dark.svg similarity index 100% rename from public/logo-theme-dark.svg rename to src/images/logo-theme-dark.svg diff --git a/public/logo-theme-light.svg b/src/images/logo-theme-light.svg similarity index 100% rename from public/logo-theme-light.svg rename to src/images/logo-theme-light.svg