naystack - v1.9.9
    Preparing search index...

    Function setupSEO

    • Creates a metadata factory for Next.js pages. Call once with your site's default SEO config, then call the returned function per-page to generate the Metadata object.

      The returned function supports page-specific title, description, and image overrides. When a page title is provided, it's formatted as "Page Title • Site Name".

      Parameters

      • SEO: { description: string; siteName: string; themeColor: string; title: string }

        Base defaults for the whole site.

        • description: string

          Default meta description.

        • siteName: string

          Application/site name (used in openGraph, twitter, and as the separator in titles).

        • themeColor: string

          Theme color for mobile browsers (e.g. "#000000").

        • title: string

          Default document title (used when no page-specific title is provided).

      Returns (
          title?: string,
          description?: string,
          image?: string | null,
          options?: SEOOptions,
      ) => Metadata

      A function (title?, description?, image?, options?) => Metadata. Pass page-specific overrides; they fill in or replace the defaults.

      // lib/utils/seo.ts
      import { setupSEO } from "naystack/utils/client";

      export const getSEO = setupSEO({
      title: "Land Exchange Toolbox - Premium Real Estate Tools",
      description: "Empower your real estate business with advanced tools.",
      siteName: "Land Exchange Toolbox",
      themeColor: "#5b9364",
      });
      // app/dashboard/page.tsx
      import { getSEO } from "@/lib/utils/seo";

      export const metadata = getSEO("Dashboard", "Your personalized dashboard");
      // => title: "Dashboard • Land Exchange Toolbox", description: "Your personalized dashboard"
      export async function generateMetadata({ params }) {
      const deal = await getDeal(params.id);
      return getSEO(deal.title, deal.description, deal.coverImage);
      }
      return getSEO(post.title, post.body, post.author.photo, { imageSize: "small" });