diff --git a/packages/docs/src/App.tsx b/packages/docs/src/App.tsx index ccde776..79dd617 100644 --- a/packages/docs/src/App.tsx +++ b/packages/docs/src/App.tsx @@ -29,7 +29,7 @@ export const routes: RouteDefinition[] = [ route({ path: "/", component: ( - + ), @@ -37,7 +37,7 @@ export const routes: RouteDefinition[] = [ route({ path: "/getting-started", component: ( - + {defer(, { name: "GettingStarted" })} ), @@ -45,7 +45,10 @@ export const routes: RouteDefinition[] = [ route({ path: "/getting-started/migrating-from-vite-spa", component: ( - + {defer(, { name: "MigratingFromViteSPA" })} ), @@ -53,13 +56,15 @@ export const routes: RouteDefinition[] = [ route({ path: "/faq", component: ( - {defer(, { name: "FAQ" })} + + {defer(, { name: "FAQ" })} + ), }), route({ path: "/api/funstack-static", component: ( - + {defer(, { name: "FunstackStaticApi" })} ), @@ -67,7 +72,7 @@ export const routes: RouteDefinition[] = [ route({ path: "/api/defer", component: ( - + {defer(, { name: "DeferApi" })} ), @@ -75,7 +80,7 @@ export const routes: RouteDefinition[] = [ route({ path: "/api/build-entry", component: ( - + {defer(, { name: "BuildEntryApi" })} ), @@ -83,7 +88,7 @@ export const routes: RouteDefinition[] = [ route({ path: "/api/entry-definition", component: ( - + {defer(, { name: "EntryDefinitionApi" })} ), @@ -91,7 +96,7 @@ export const routes: RouteDefinition[] = [ route({ path: "/learn/how-it-works", component: ( - + {defer(, { name: "HowItWorks" })} ), @@ -99,7 +104,7 @@ export const routes: RouteDefinition[] = [ route({ path: "/learn/rsc", component: ( - + {defer(, { name: "RSCConcept" })} ), @@ -107,7 +112,10 @@ export const routes: RouteDefinition[] = [ route({ path: "/learn/optimizing-payloads", component: ( - + {defer(, { name: "OptimizingPayloads" })} ), @@ -115,7 +123,10 @@ export const routes: RouteDefinition[] = [ route({ path: "/learn/lazy-server-components", component: ( - + {defer(, { name: "LazyServerComponents" })} ), @@ -123,7 +134,10 @@ export const routes: RouteDefinition[] = [ route({ path: "/learn/defer-and-activity", component: ( - + {defer(, { name: "DeferAndActivity" })} ), @@ -131,7 +145,7 @@ export const routes: RouteDefinition[] = [ route({ path: "/learn/file-system-routing", component: ( - + {defer(, { name: "FileSystemRouting" })} ), @@ -139,7 +153,10 @@ export const routes: RouteDefinition[] = [ route({ path: "/advanced/multiple-entrypoints", component: ( - + {defer(, { name: "MultipleEntrypoints" })} ), @@ -147,7 +164,7 @@ export const routes: RouteDefinition[] = [ route({ path: "/advanced/ssr", component: ( - + {defer(, { name: "SSR" })} ), @@ -155,7 +172,7 @@ export const routes: RouteDefinition[] = [ route({ path: "*", component: ( - + ), diff --git a/packages/docs/src/build.ts b/packages/docs/src/build.ts index 620adb5..66d3d38 100644 --- a/packages/docs/src/build.ts +++ b/packages/docs/src/build.ts @@ -3,8 +3,7 @@ import path from "node:path"; import type { BuildEntryFunction } from "@funstack/static/server"; import type { RouteDefinition } from "@funstack/router/server"; import { routes } from "./App"; - -const siteUrl = "https://static.funstack.work"; +import { siteUrl } from "./constants"; function collectPaths(routes: RouteDefinition[]): string[] { const paths: string[] = []; diff --git a/packages/docs/src/components/Layout/Layout.tsx b/packages/docs/src/components/Layout/Layout.tsx index 76a5a2b..97ad036 100644 --- a/packages/docs/src/components/Layout/Layout.tsx +++ b/packages/docs/src/components/Layout/Layout.tsx @@ -1,5 +1,6 @@ import type React from "react"; import { Suspense } from "react"; +import { siteUrl } from "../../constants"; import { Header } from "../Header/Header"; import { MobileMenu } from "../MobileMenu/MobileMenu"; import { Sidebar } from "../Sidebar/Sidebar"; @@ -12,23 +13,28 @@ interface LayoutProps { children: React.ReactNode; variant?: LayoutVariant; title?: string; + path: string; } export const Layout: React.FC = ({ children, variant = "docs", title, + path, }) => { const layoutClass = variant === "home" ? styles.homeLayout : styles.docsLayout; const fullTitle = title ? `${title} | FUNSTACK Static` : "FUNSTACK Static - docs"; + const canonicalUrl = path === "/" ? `${siteUrl}/` : `${siteUrl}${path}`; return (
{fullTitle} + +
} />
diff --git a/packages/docs/src/constants.ts b/packages/docs/src/constants.ts new file mode 100644 index 0000000..0c43293 --- /dev/null +++ b/packages/docs/src/constants.ts @@ -0,0 +1 @@ +export const siteUrl = "https://static.funstack.work";