For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign in
DocsAPI ReferenceChangelog
DocsAPI ReferenceChangelog
  • Get started
    • Quickstart
    • Concepts
  • Guides
    • Environments
  • Reference
      • Makeswift API Handler
        • getSiteVersion
    • Product docs
    • Blog
    • Support
Sign in
LogoLogo
On this page
  • Arguments
  • Example
Reference@makeswift/runtimeFunctions

getSiteVersion

Was this page helpful?
Previous

registerComponent

Next

getSitemap

Built with

A function that returns the current version of the Makeswift site. This function is currently only used when calling getPageSnapshot when using App Router in Next.js.

This function can only be called inside of a React Server Component or Route Handler.

Arguments

This function doesn’t take any arguments.

Example

The following example calls getPageSnapshot to query a page snapshot for the root route and passes the return value from getSiteVersion in its configuration options. It then renders the page using the Page component.

1import { Page } from "@makeswift/runtime/next";
2import { client } from "../../../../makeswift/client";
3import { getSiteVersion } from "@makeswift/runtime/next/server";
4
5export default function Page() {
6 const snapshot = await client.getPageSnapshot("/", {
7 siteVersion: getSiteVersion(),
8 });
9
10 if (snapshot == null) notFound();
11
12 return <Page snapshot={snapshot} />;
13}

For a more detailed walkthrough, refer to the App Router Installation guide.