Skip to content

πŸ“ˆ Open source, privacy-first web analytics β€” a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

2.8 KB
Raw Blame
import { RootProvider } from "fumadocs-ui/provider/next";
import { DocsLayout } from "fumadocs-ui/layouts/docs";
import { GithubInfo } from "fumadocs-ui/components/github-info";
import type { ReactNode } from "react";
import { addIntegrationLogos } from "@/components/IntegrationLogo";
import { source } from "@/lib/source";
import { MobileHeader } from "@/components/MobileHeader";
import Footer from "./components/Footer";
import Analytics from "./components/Analytics";
import "./global.css";

const defaultOgImage =
  "https://swetrix.com/api/og-image.png?title=Swetrix+Docs&description=Open-source%2C+privacy-first+web+analytics+documentation&label=Docs";

export const metadata = {
  title: {
    template: "%s | Swetrix Docs",
    default: "Swetrix Docs",
  },
  description: "Swetrix documentation β€” turn traffic into insights.",
  icons: { icon: "/favicon.ico" },
  openGraph: {
    title: "Swetrix Docs",
    description: "Swetrix documentation β€” turn traffic into insights.",
    images: [{ url: defaultOgImage, width: 1800, height: 945, alt: "Swetrix Docs" }],
  },
  twitter: {
    card: "summary_large_image" as const,
    title: "Swetrix Docs",
    description: "Swetrix documentation β€” turn traffic into insights.",
    images: [defaultOgImage],
  },
};

export default function RootLayout({ children }: { children: ReactNode }) {
  return (
    <html lang="en" suppressHydrationWarning>
      <head />
      <body>
        <RootProvider search={{ options: { api: "/docs/api/search" } }}>
          <DocsLayout
            slots={{ header: MobileHeader }}
            tree={addIntegrationLogos(source.getPageTree())}
            nav={{
              title: (
                <div className="flex -translate-y-[2px] items-center gap-2 select-none">
                  <img
                    className="-translate-y-px dark:hidden"
                    height="28"
                    width="24"
                    src="/assets/logo/dark.svg"
                    alt=""
                  />
                  <img
                    className="-translate-y-px hidden dark:block"
                    height="28"
                    width="24"
                    src="/assets/logo/light.svg"
                    alt=""
                  />
                  <span className="text-2xl leading-5 font-bold text-slate-900 dark:text-white">
                    Swetrix
                  </span>
                </div>
              ),
              url: "https://swetrix.com",
            }}
            links={[
              {
                type: "custom",
                children: <GithubInfo owner="Swetrix" repo="swetrix" className="lg:-mx-2" />,
              },
            ]}
          >
            {children}
          </DocsLayout>
          <Footer />
          <Analytics />
        </RootProvider>
      </body>
    </html>
  );
}