import "./chunk-BJTO5JO5.mjs";

// src/metadata/generatePageMetadata.ts
function generatePageMetadata(input) {
  const { page, site, path, siteUrl, overrides, googleSiteVerification } = input;
  const pageTitle = overrides?.title ?? page.name;
  const fullTitle = pageTitle === site.title ? pageTitle : `${pageTitle} | ${site.title}`;
  const description = overrides?.description ?? page.purpose;
  const canonicalUrl = overrides?.canonicalUrl ?? `${siteUrl}${path}`;
  const fullUrl = `${siteUrl}${path}`;
  const metadata = {
    title: fullTitle,
    description: description ?? void 0,
    alternates: {
      canonical: canonicalUrl
    },
    openGraph: {
      title: pageTitle,
      description: description ?? void 0,
      url: fullUrl,
      siteName: site.title,
      type: "website",
      ...overrides?.ogImage ? {
        images: [
          {
            url: overrides.ogImage,
            alt: pageTitle
          }
        ]
      } : {}
    },
    twitter: {
      card: "summary_large_image",
      title: pageTitle,
      description: description ?? void 0,
      ...overrides?.ogImage ? {
        images: [overrides.ogImage]
      } : {}
    }
  };
  if (overrides?.robots) {
    metadata.robots = {
      index: overrides.robots.index ?? true,
      follow: overrides.robots.follow ?? true
    };
  }
  if (googleSiteVerification) {
    metadata.verification = {
      google: googleSiteVerification
    };
  }
  return metadata;
}
function generatePreviewMetadata(input) {
  return generatePageMetadata({
    ...input,
    overrides: {
      ...input.overrides,
      robots: {
        index: false,
        follow: false
      }
    }
  });
}
export {
  generatePageMetadata,
  generatePreviewMetadata
};
//# sourceMappingURL=metadata.mjs.map