Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

2.3 KB
Raw Blame
import type { Metadata } from "next";

import { SeoLandingShell } from "@/app/(main)/(seo-landings)/components/seo-landing-shell";
import {
  SEO_LANDING_DEFINITIONS,
  type SeoLandingSlug,
} from "@/app/(main)/(seo-landings)/seo-landing-definitions";
import { APP_URL, STATIC_ASSETS_URL, TWITTER_CREATOR } from "@/config";

export function buildSeoLandingMetadata(slug: SeoLandingSlug): Metadata {
  const definition = SEO_LANDING_DEFINITIONS[slug];

  if (!definition) {
    throw new Error(
      `\n\n🚨🚨🚨 [buildSeoLandingMetadata] SEO landing definition not found for slug: ____${slug}____ 🚨🚨🚨\n\n`,
    );
  }

  const pageUrl = `${APP_URL}/${definition.slug}`;

  const ogImage = `${STATIC_ASSETS_URL}/easy-invoice-opengraph-image.png?v=1755773879597`;

  return {
    title: definition.metadata.title,
    description: definition.metadata.description,
    keywords: definition.metadata.keywords,
    alternates: {
      canonical: pageUrl,
    },
    openGraph: {
      title: definition.metadata.title,
      description: definition.metadata.description,
      siteName: "EasyInvoicePDF.com | Free Invoice Generator",
      locale: "en_US",
      type: "website",
      url: pageUrl,
      images: [
        {
          url: ogImage,
          width: 1200,
          height: 630,
          type: "image/png",
          alt: "EasyInvoicePDF.com - Free Invoice PDF Generator",
        },
      ],
    },
    twitter: {
      card: "summary_large_image",
      title: definition.metadata.title,
      description: definition.metadata.description,
      creator: TWITTER_CREATOR,
      images: [
        {
          url: ogImage,
          width: 1200,
          height: 630,
          type: "image/png",
          alt: "EasyInvoicePDF.com - Free Invoice PDF Generator",
        },
      ],
    },
    robots: {
      index: true,
      follow: true,
      googleBot: {
        index: true,
        follow: true,
      },
    },
  };
}

export function SeoLandingRoutePage({ slug }: { slug: SeoLandingSlug }) {
  const definition = SEO_LANDING_DEFINITIONS[slug];

  if (!definition) {
    throw new Error(
      `\n\n🚨🚨🚨 [SeoLandingRoutePage] SEO landing definition not found for slug: ____${slug}____ 🚨🚨🚨\n\n`,
    );
  }

  return <SeoLandingShell definition={definition} />;
}