> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.makeswift.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.makeswift.com/_mcp/server.

# getSiteVersion

> A static method on the `Makeswift` class that returns the current version of the Makeswift site. This method is currently only used when calling `getPageSnapshot` and using **Pages Router** in Next.js.

A static method on the `Makeswift` class that returns the current version of the Makeswift site. This method is currently only used when calling `getPageSnapshot` and using **Pages Router** in Next.js.

## Arguments

**`previewData`** `PreviewData` — required

The preview data provided in
[`getStaticProps`](https://nextjs.org/docs/pages/api-reference/functions/get-static-props).

---

## Example

The following example sets up a [catch all route](https://nextjs.org/docs/pages/building-your-application/routing/dynamic-routes#catch-all-segments) where page snapshots are fetched from Makeswift using `siteVersion` and rendered using the [`<Page>`](/developer/docs/reference/components/page) component.

**`src/pages/[[...path]].tsx`**

```tsx src/pages/[[...path]].tsx
import {
  GetStaticPathsResult,
  GetStaticPropsContext,
  GetStaticPropsResult,
} from "next";

import {
  Page as MakeswiftPage,
  PageProps as MakeswiftPageProps,
  Makeswift,
  type SiteVersion
} from "@makeswift/runtime/next";

import { client } from "@/makeswift/client";
import "@/makeswift/components";

type ParsedUrlQuery = { path?: string[] };

export async function getStaticPaths(): Promise<
  GetStaticPathsResult<ParsedUrlQuery>
> {
  const pages = await client.getPages().toArray();

  return {
    paths: pages.map((page) => ({
      params: {
        path: page.path.split("/").filter((segment) => segment !== ""),
      },
    })),
    fallback: "blocking",
  };
}

export type PageProps = MakeswiftPageProps & {
  siteVersion: SiteVersion | null;
};

export async function getStaticProps({
  params,
  previewData,
}: GetStaticPropsContext<ParsedUrlQuery>): Promise<
  GetStaticPropsResult<PageProps>
> {
  const path = "/" + (params?.path ?? []).join("/");
  const siteVersion = Makeswift.getSiteVersion(previewData);
  const snapshot = await client.getPageSnapshot(path, {
    siteVersion,
  });

  if (snapshot == null) return { notFound: true };

  return {
    props: {
      snapshot,
      siteVersion,
    },
  };
}

export default function Page({ snapshot }: MakeswiftPageProps) {
  return <MakeswiftPage snapshot={snapshot} />;
}
```