Skip to content

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

chore: refactor metadata handling to include APP_URL for canonical links and enhance Open Graph support (#131)

Vlad Sazonau57c0e35fe2d7
diff --git a/playwright.config.ts b/playwright.config.ts
index 848c11a..61a9344 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -28,12 +28,12 @@ export default defineConfig({
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
- retries: process.env.CI ? 1 : 0,
+ retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
- workers: process.env.CI ? 1 : undefined,
+ workers: process.env.CI ? 2 : undefined,
/* timeout for expect assertions */
expect: {
- timeout: 30_000,
+ timeout: 40_000,
},
// /* timeout for test execution */
diff --git a/src/app/(app)/page.tsx b/src/app/(app)/page.tsx
index 0fec96b..f5f3305 100644
--- a/src/app/(app)/page.tsx
+++ b/src/app/(app)/page.tsx
@@ -1,6 +1,6 @@
import type { Metadata } from "next";
import { AppPageClient } from "./page.client";
-import { STATIC_ASSETS_URL } from "@/config";
+import { APP_URL, STATIC_ASSETS_URL } from "@/config";
// we generate metadata here, because we need access to searchParams (in layout we don't have it)
export async function generateMetadata({
@@ -39,25 +39,85 @@ export async function generateMetadata({
},
}
: defaultRobotsConfig,
- alternates: {
- canonical: "/",
- },
- ...(isStripeTemplate && {
- openGraph: {
- title: "Stripe Invoice Template | Free Invoice Generator",
- description:
- "Create and download professional invoices instantly with EasyInvoicePDF.com. Free and open-source. No signup required.",
- siteName: "EasyInvoicePDF.com | Free Invoice Generator",
- images: [
- {
- url: `${STATIC_ASSETS_URL}/stripe-og.png?v=1755773921680`,
- width: 1200,
- height: 630,
- alt: "Stripe Invoice Template",
+ ...(isStripeTemplate
+ ? {
+ // stripe template
+ alternates: {
+ canonical: `${APP_URL}/?template=stripe`,
+ },
+ openGraph: {
+ title: "Stripe Invoice Template | Free Invoice Generator",
+ description:
+ "Create and download professional invoices instantly with EasyInvoicePDF.com. Free and open-source. No signup required.",
+ siteName: "EasyInvoicePDF.com | Free Invoice Generator",
+ locale: "en_US",
+ type: "website",
+ url: `${APP_URL}/?template=stripe`,
+ images: [
+ {
+ url: `${STATIC_ASSETS_URL}/stripe-og.png?v=1755773921680`,
+ width: 1200,
+ height: 630,
+ alt: "Stripe Invoice Template",
+ },
+ ],
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: "Stripe Invoice Template | Free Invoice Generator",
+ description:
+ "Create and download professional invoices instantly with EasyInvoicePDF.com. Free and open-source. No signup required.",
+ creator: "@vlad_sazon",
+ images: [
+ {
+ url: `${STATIC_ASSETS_URL}/stripe-og.png?v=1755773921680`,
+ width: 1200,
+ height: 630,
+ alt: "Stripe Invoice Template",
+ },
+ ],
+ },
+ }
+ : {
+ // default template
+ alternates: {
+ canonical: `${APP_URL}/?template=default`,
+ },
+ openGraph: {
+ title: "App | Free Invoice Generator – Live Preview, No Sign-Up",
+ description:
+ "Create and download professional invoices instantly with EasyInvoicePDF.com. Free and open-source. No signup required.",
+ siteName: "EasyInvoicePDF.com | Free Invoice Generator",
+ locale: "en_US",
+ type: "website",
+ url: `${APP_URL}/?template=default`,
+ images: [
+ {
+ url: `${STATIC_ASSETS_URL}/easy-invoice-opengraph-image.png?v=1755773879597`,
+ type: "image/png",
+ width: 1200,
+ height: 630,
+ alt: "EasyInvoicePDF.com - Free Invoice Generator with Live PDF Preview",
+ },
+ ],
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: "App | Free Invoice Generator – Live Preview, No Sign-Up",
+ description:
+ "Create and download professional invoices instantly with EasyInvoicePDF.com. Free and open-source. No signup required.",
+ creator: "@vlad_sazon",
+ images: [
+ {
+ url: `${STATIC_ASSETS_URL}/easy-invoice-opengraph-image.png?v=1755773879597`,
+ type: "image/png",
+ width: 1200,
+ height: 630,
+ alt: "EasyInvoicePDF.com - Free Invoice Generator with Live PDF Preview",
+ },
+ ],
},
- ],
- },
- }),
+ }),
};
}
diff --git a/src/app/[locale]/about/layout.tsx b/src/app/[locale]/about/layout.tsx
index 8ada1a4..be01856 100644
--- a/src/app/[locale]/about/layout.tsx
+++ b/src/app/[locale]/about/layout.tsx
@@ -4,7 +4,7 @@ import { routing } from "@/i18n/routing";
import { setRequestLocale } from "next-intl/server";
import type { Metadata } from "next";
import type EnMessages from "../../../../messages/en.json";
-import { STATIC_ASSETS_URL } from "@/config";
+import { APP_URL, STATIC_ASSETS_URL } from "@/config";
// Add metadata to make sure search engines can index the page
export async function generateMetadata({
@@ -23,18 +23,18 @@ export async function generateMetadata({
description: messages.Metadata.about.description,
keywords: messages.Metadata.about.keywords,
alternates: {
- canonical: `/${params.locale}/about`,
+ canonical: `${APP_URL}/${params.locale}/about`,
languages: {
- en: `/en/about`,
- pl: `/pl/about`,
- de: `/de/about`,
- es: `/es/about`,
- pt: `/pt/about`,
- ru: `/ru/about`,
- uk: `/uk/about`,
- fr: `/fr/about`,
- it: `/it/about`,
- nl: `/nl/about`,
+ en: `${APP_URL}/en/about`,
+ pl: `${APP_URL}/pl/about`,
+ de: `${APP_URL}/de/about`,
+ es: `${APP_URL}/es/about`,
+ pt: `${APP_URL}/pt/about`,
+ ru: `${APP_URL}/ru/about`,
+ uk: `${APP_URL}/uk/about`,
+ fr: `${APP_URL}/fr/about`,
+ it: `${APP_URL}/it/about`,
+ nl: `${APP_URL}/nl/about`,
} satisfies Record<Locale, string>,
},
openGraph: {
@@ -43,7 +43,7 @@ export async function generateMetadata({
siteName: messages.Metadata.about.siteName,
locale: params.locale,
type: "website",
- url: "https://easyinvoicepdf.com",
+ url: `${APP_URL}/${params.locale}/about`,
images: [
{
url: `${STATIC_ASSETS_URL}/easy-invoice-opengraph-image.png?v=1755773879597`,
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 3e1b185..71e312a 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -10,7 +10,7 @@ import Script from "next/script";
import { type WebSite, type WithContext } from "schema-dts";
import { Toaster } from "sonner";
-import { APP_URL, STATIC_ASSETS_URL } from "@/config";
+import { STATIC_ASSETS_URL } from "@/config";
import "./globals.css";
@@ -25,7 +25,7 @@ export const viewport: Viewport = {
};
export const metadata: Metadata = {
- metadataBase: new URL(APP_URL),
+ // metadataBase: new URL(APP_URL),
title: "App | Free Invoice Generator – Live Preview, No Sign-Up",
description:
"Create and download professional invoices instantly with EasyInvoicePDF.com. Free and open-source. No signup required.",
@@ -53,40 +53,6 @@ export const metadata: Metadata = {
},
],
},
- openGraph: {
- title: "App | Free Invoice Generator – Live Preview, No Sign-Up",
- description:
- "Create and download professional invoices instantly with EasyInvoicePDF.com. Free and open-source. No signup required.",
- siteName: "EasyInvoicePDF.com | Free Invoice Generator",
- locale: "en_US",
- type: "website",
- url: "https://easyinvoicepdf.com",
- images: [
- {
- url: `${STATIC_ASSETS_URL}/easy-invoice-opengraph-image.png?v=1755773879597`,
- type: "image/png",
- width: 1200,
- height: 630,
- alt: "EasyInvoicePDF.com - Free Invoice Generator with Live PDF Preview",
- },
- ],
- },
- twitter: {
- card: "summary_large_image",
- title: "App | Free Invoice Generator – Live Preview, No Sign-Up",
- description:
- "Create and download professional invoices instantly with EasyInvoicePDF.com. Free and open-source. No signup required.",
- creator: "@vlad_sazon",
- images: [
- {
- url: `${STATIC_ASSETS_URL}/easy-invoice-opengraph-image.png?v=1755773879597`,
- type: "image/png",
- width: 1200,
- height: 630,
- alt: "EasyInvoicePDF.com - Free Invoice Generator with Live PDF Preview",
- },
- ],
- },
};
const JSONLD: WithContext<WebSite> = {