The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
---
import { getCollection } from 'astro:content'
import { genFaviconLinks } from 'common/MetaFavicons/icons'
import Footer from '../components/Footer.astro'
import { Header } from '../components/Header'
import { toSummary, toTroubleshootingSummary } from '../lib/guides'
import { getListedTopics } from '../lib/topics'
import '../styles/globals.css'
import { canonicalUrl, serializeJsonLd } from '../lib/json-ld'
interface Props {
title?: string
description?: string
jsonLd?: Record<string, unknown> | Record<string, unknown>[]
}
const { title, description, jsonLd } = Astro.props
// the nav lists only topics with entries
const navTopics = getListedTopics({
guides: (await getCollection('guides')).map(toSummary),
troubleshooting: (await getCollection('troubleshooting')).map(toTroubleshootingSummary),
}).map((topic) => topic.name)
const faviconRoute = import.meta.env.DEV ? '/favicon/local' : '/favicon'
const canonicalHref = canonicalUrl(Astro.url.pathname)
const ogImage = title
? `https://obuldanrptloktxcffvn.supabase.co/functions/v1/og-images?site=kb&title=${encodeURIComponent(title)}&description=${encodeURIComponent(description ?? 'undefined')}`
: 'https://supabase.com/docs/img/supabase-og-image.png'
const pageTitle = title ? `${title} | Supabase Knowledge Base` : 'Supabase Knowledge Base'
---
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
{description && <meta name="description" content={description} />}
<script is:inline>
// Set data-theme on <html> before first paint, so the page doesn't flash
// the wrong theme while this loads. Defaults to dark, and "system" follows the
// OS preference, including changes mid-session (choices come from components/HeaderMenu.tsx).
;(function () {
var systemDark = window.matchMedia('(prefers-color-scheme: dark)')
var applyTheme = function () {
try {
var stored = localStorage.getItem('theme')
var theme = stored === 'system' ? (systemDark.matches ? 'dark' : 'light') : stored === 'light' ? 'light' : 'dark'
document.documentElement.setAttribute('data-theme', theme)
} catch (_) {}
}
applyTheme()
systemDark.addEventListener('change', applyTheme)
})()
</script>
{genFaviconLinks(import.meta.env.BASE_URL, faviconRoute).map((link) => <link {...link} />)}
<link rel="manifest" href={`${import.meta.env.BASE_URL.replace(/\/$/, '')}${faviconRoute}/manifest.json`} />
<meta name="generator" content={Astro.generator} />
<!-- Same Inter/Manrope fonts apps/docs loads via next/font, self-hosted there;
loaded from Google Fonts here since kb has no next/font equivalent. -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap"
/>
<link rel="canonical" href={canonicalHref} />
<link rel="sitemap" href={`${import.meta.env.BASE_URL}/sitemap-index.xml`} />
<title>{pageTitle}</title>
<meta property="og:type" content="article" />
<meta property="og:title" content={pageTitle} />
{description && <meta property="og:description" content={description} />}
<meta property="og:url" content={canonicalHref} />
<meta property="og:image" content={ogImage} />
<meta property="og:image:alt" content={title ?? pageTitle} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@supabase" />
<meta name="twitter:creator" content="@supabase" />
<meta name="twitter:image" content={ogImage} />
{jsonLd && <script type="application/ld+json" is:inline set:html={serializeJsonLd(jsonLd)} />}
</head>
<body class="flex min-h-dvh flex-col">
<div class="sticky top-0 z-40">
<Header client:load topics={navTopics} />
</div>
<main class="grow">
<slot />
</main>
<Footer />
</body>
</html>
<style>
:root {
--header-height: 50px;
--nav-inset: 10rem;
}
html {
scroll-behavior: smooth;
scroll-padding-top: var(--header-height);
font-weight: 500;
}
html[data-theme*='dark'] {
font-weight: 450;
}
html,
body {
margin: 0;
width: 100%;
min-height: 100%;
overscroll-behavior-y: none;
}
body {
background-color: var(--background);
color: var(--foreground);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>