Skip to content

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

feat(seo): smaller mobile SEO copy, sized landing hero images, Next 16.3.8 (#283)

Vlad Sazonau13e4fdc8da6a
diff --git a/e2e/seo-landings.test.ts b/e2e/seo-landings.test.ts
index fda603d..68f2634 100644
--- a/e2e/seo-landings.test.ts
+++ b/e2e/seo-landings.test.ts
@@ -15,7 +15,10 @@ const SEO_LANDING_CASES = SLUGS.map((slug) => {
h1: SEO_LANDING_DEFINITIONS[slug].hero.h1,
subheading: SEO_LANDING_DEFINITIONS[slug].hero.subheading,
ctaName: SEO_LANDING_DEFINITIONS[slug].hero.ctaLabel,
- heroImageSrc: SEO_LANDING_DEFINITIONS[slug].hero.heroImage,
+ heroImage:
+ "heroImage" in SEO_LANDING_DEFINITIONS[slug].hero
+ ? SEO_LANDING_DEFINITIONS[slug].hero.heroImage
+ : undefined,
heroVideo:
"heroVideo" in SEO_LANDING_DEFINITIONS[slug].hero
? SEO_LANDING_DEFINITIONS[slug].hero.heroVideo
@@ -25,14 +28,7 @@ const SEO_LANDING_CASES = SLUGS.map((slug) => {
});
test.describe("SEO landing pages", () => {
- for (const {
- path,
- h1,
- subheading,
- ctaName,
- heroImageSrc,
- ctaHref,
- } of SEO_LANDING_CASES) {
+ for (const { path, h1, subheading, ctaName, ctaHref } of SEO_LANDING_CASES) {
test(`should render ${path}`, async ({ page }) => {
await page.goto(path);
@@ -57,18 +53,6 @@ test.describe("SEO landing pages", () => {
// the hero opener is a paragraph, so that the section titles are the page's h2s
await expect(page.getByText(subheading, { exact: true })).toBeVisible();
- /** Check that hero image exists and loads */
- const imageRes = await fetch(heroImageSrc);
-
- const imageOk = imageRes.ok;
- expect(imageOk).toBe(true);
-
- const imageStatus = imageRes.status;
- expect(imageStatus).toBe(200);
-
- const imageHeaders = imageRes.headers;
- expect(imageHeaders.get("content-type")).toContain("image/png");
-
const primaryCtas = page.getByRole("link", {
name: ctaName,
exact: true,
@@ -158,23 +142,44 @@ test.describe("SEO landing pages", () => {
* two shapes are asserted by separate tests rather than a branch inside one -- a
* conditional `expect` passes just as happily when neither arm runs.
*/
-const IMAGE_HERO_CASES = SEO_LANDING_CASES.filter((landingCase) => {
- return !landingCase.heroVideo;
-});
-
-const VIDEO_HERO_CASES = SEO_LANDING_CASES.filter((landingCase) => {
- return Boolean(landingCase.heroVideo);
-});
+const IMAGE_HERO_CASES = SEO_LANDING_CASES.filter(
+ (landingCase): landingCase is SeoLandingCaseWith<"heroImage"> => {
+ return landingCase.heroImage !== undefined;
+ },
+);
+
+const VIDEO_HERO_CASES = SEO_LANDING_CASES.filter(
+ (landingCase): landingCase is SeoLandingCaseWith<"heroVideo"> => {
+ return landingCase.heroVideo !== undefined;
+ },
+);
test.describe("SEO landing hero art", () => {
- for (const { path, h1, heroImageSrc } of IMAGE_HERO_CASES) {
+ for (const { path, h1, heroImage } of IMAGE_HERO_CASES) {
test(`shows the hero image on ${path}`, async ({ page }) => {
await page.goto(path);
const img = page.getByRole("img", { name: h1 });
await expect(img).toBeVisible();
- await expect(img).toHaveAttribute("src", heroImageSrc);
+ await expect(img).toHaveAttribute("src", heroImage.src);
+
+ // the declared size reserves the hero's box before the file loads, so it has to
+ // match the file itself or the page shifts when the image arrives
+ await expect
+ .poll(() => {
+ return img.evaluate((el: HTMLImageElement) => {
+ return { width: el.naturalWidth, height: el.naturalHeight };
+ });
+ })
+ .toEqual({ width: heroImage.width, height: heroImage.height });
+
+ /** Check that hero image exists and loads */
+ const imageRes = await fetch(heroImage.src);
+
+ expect(imageRes.ok).toBe(true);
+ expect(imageRes.status).toBe(200);
+ expect(imageRes.headers.get("content-type")).toContain("image/png");
});
}
@@ -185,11 +190,11 @@ test.describe("SEO landing hero art", () => {
const video = page.getByTestId("seo-landing-hero-video");
await expect(video).toBeVisible();
- await expect(video).toHaveAttribute("title", heroVideo?.title ?? "");
+ await expect(video).toHaveAttribute("title", heroVideo.title);
await expectYouTubeEmbedToShow({
embed: video,
- embedUrl: heroVideo?.embedUrl ?? "",
+ embedUrl: heroVideo.embedUrl,
});
// the hero waits to be pressed; nothing on a landing page starts by itself
@@ -204,9 +209,16 @@ test.describe("SEO landing hero art", () => {
.first()
.textContent();
- expect(jsonLd).toContain(heroVideo?.uploadDate);
- expect(jsonLd).toContain(heroVideo?.thumbnailUrl);
+ expect(jsonLd).toContain(heroVideo.uploadDate);
+ expect(jsonLd).toContain(heroVideo.thumbnailUrl);
expect(jsonLd).toContain("VideoObject");
});
}
});
+
+type SeoLandingCase = (typeof SEO_LANDING_CASES)[number];
+
+/** A landing case whose `key` is known to be set, which `.filter` can't infer by itself. */
+type SeoLandingCaseWith<Key extends keyof SeoLandingCase> = SeoLandingCase & {
+ [K in Key]-?: NonNullable<SeoLandingCase[K]>;
+};
diff --git a/package.json b/package.json
index 443bcc2..634f0e3 100644
--- a/package.json
+++ b/package.json
@@ -53,7 +53,7 @@
"@hookform/resolvers": "5.9.1",
"@mdx-js/loader": "3.1.0",
"@mdx-js/react": "3.1.0",
- "@next/mdx": "16.3.4",
+ "@next/mdx": "16.3.8",
"@radix-ui/react-accordion": "1.2.3",
"@radix-ui/react-alert-dialog": "1.1.6",
"@radix-ui/react-dialog": "1.1.6",
@@ -90,7 +90,7 @@
"lucide-react": "0.477.0",
"lz-string": "1.5.0",
"motion": "12.38.0",
- "next": "16.3.4",
+ "next": "16.3.8",
"next-intl": "4.13.7",
"pdfjs-dist": "5.4.296",
"qrcode": "1.5.4",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 095b402..c93c9c1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -38,8 +38,8 @@ importers:
specifier: 3.1.0
version: 3.1.0(@types/[email protected])([email protected])
'@next/mdx':
- specifier: 16.3.4
+ specifier: 16.3.8
'@radix-ui/react-accordion':
specifier: 1.2.3
@@ -78,7 +78,7 @@ importers:
version: 4.6.1([email protected])
'@sentry/nextjs':
specifier: 10.70.0
'@t3-oss/env-nextjs':
specifier: 0.13.4
@@ -105,7 +105,7 @@ importers:
version: 3.5.1
'@vercel/speed-insights':
specifier: 1.2.0
class-variance-authority:
specifier: 0.7.1
version: 0.7.1
@@ -149,11 +149,11 @@ importers:
specifier: 12.38.0
next:
- specifier: 16.3.4
+ specifier: 16.3.8
next-intl:
specifier: 4.13.7
pdfjs-dist:
specifier: 5.4.296
version: 5.4.296
@@ -1398,11 +1398,11 @@ packages:
resolution: {integrity: sha512-a26KnbW9DFEUsSxAxKBORR/uD9THoYoKbkpFywMN/AFvboTt94b8+g/07T8J6ACsdLag8/PDU60ov4rPxRAixw==}
- resolution: {integrity: sha512-cjWZnUUa6jZq2kFaNe/ZyJdZonOZ/QoN0Zka2nz/FLOrfx14pQuM9c5RaSVkWMqgdt4ksgPAMWPyHSs/CyV48Q==}
+ resolution: {integrity: sha512-Al9zqHVV7TJv0eFuOU4U7Lvv74PTih4Ch63sk2xCIpSTkE3udFnaOcnzP2lQVymiL7yS9Cj2iClUXlR3EQ5sEw==}
- resolution: {integrity: sha512-XEmW3ccWWNybofVOmgIEVhXtmNXM0u423iqkVXwPf29fht/tdpUiMDuMHQ4hMerE1477nOJrv5kM/F6qMcEMwA==}
+ resolution: {integrity: sha512-9Es7/Mf5cDo7dL3NEUQerl98SrwWo0QeBguKC06rX/PydHXKxgHIuXjDuxvu56oO4Yty4hn3FPIbXEOx39oQDw==}
peerDependencies:
'@mdx-js/loader': '>=0.15.0'
'@mdx-js/react': '>=0.15.0'
@@ -1418,8 +1418,8 @@ packages:
cpu: [arm64]
os: [darwin]
- resolution: {integrity: sha512-iBr3I5LZNk5/bgl5//iTgD2tcym14MX0Xo7fD//u9dYAEgGzza1y9oywluPtf74YnOswVdH1908aK9xVz7zQTw==}
+ resolution: {integrity: sha512-2JPRMh2nmQG5CiL7cXGL9AGwnPWJQ//cTtAUCT+w511QHk79SYz3LGv/pc5X643B/WEO0rvu3Yww0hqwt3kgeA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
@@ -1430,8 +1430,8 @@ packages:
cpu: [x64]
os: [darwin]
- resolution: {integrity: sha512-2dpiSyl2Jw/NrBPaU2MAKGSa+2MR82pJIn4Sm5Rjr+gxAeuh0z158Su3Z2O8zn7UNNq+ej4bToed6RcRN/Lydg==}
+ resolution: {integrity: sha512-GZtCCOBKJ4leVIT/Th0llWKhD1ca92lzbQiS5R5ON9QkoiFnilFsebDae1JU2a3HWoKMEmEZWGs1AGLavVM72Q==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
@@ -1443,8 +1443,8 @@ packages:
os: [linux]
libc: [glibc]
- resolution: {integrity: sha512-+t+U8HZT+fApePCS5h89CSH3datz29MkzyfCn+6fpsZBG/oiEOhINcb9rtkv6sdpToLGFn2e6146NzaKCXkqrA==}
+ resolution: {integrity: sha512-O659ygeQYqneJ1fBKMpFxIFqYkYswu8IAS1OCKK/4f3ZgJJm1dRz4fVJZRi/kLLWjnBKnebOePA4WNv+sV1pVA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@@ -1457,8 +1457,8 @@ packages:
os: [linux]
libc: [musl]
- resolution: {integrity: sha512-mx03GNs1ocQA5JQ4FxDMmIsNkdrZh8cuezKCrId28e5/gIPU/l7Kcy2+vmCCzdjnnmXJy+iOAu+7K0QppO6Urg==}
+ resolution: {integrity: sha512-dSjKSyWpzxoO1d3DIZZcP4XJcNaKeLmxQMFOiYl5vuBRMmweIqnAhty8tAmRsvTss779cK1FtYnDMj40e4TQlg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@@ -1471,8 +1471,8 @@ packages:
os: [linux]
libc: [glibc]
- resolution: {integrity: sha512-YIhGY6fSMfha52bnVxnzc9zaVBzJg+cqQTOD8tXIBSx4fuv0pVMxQTE0PaS59YhnMOiYiG09IMwxJAf/CFm/Dw==}
+ resolution: {integrity: sha512-lbqOuz3RPRcv+o9msNsJw5x4+Y1ZwPTs6vmL6DCf7i0fZfvng/F59wyeDwqHIvV0mK//RBy/jJkZ+nCKsSMXjQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@@ -1485,8 +1485,8 @@ packages:
os: [linux]
libc: [musl]
- resolution: {integrity: sha512-+eaaX6axpDb0yF1GCpiERe6njplvdC+nks/fKfcHu3XPGRrald8P3/X7yv7QLdjA51knnxwl9pxdIJsg+w1L+Q==}
+ resolution: {integrity: sha512-+316WswI8ScVgZeUd+1KGaXkHhaYQzCjvH/05TZSpJ8zBizb1a4G7DtO7F12jcBIqMOtsz9ji1t48fmKtzqsGA==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@@ -1498,8 +1498,8 @@ packages:
cpu: [arm64]
os: [win32]
- resolution: {integrity: sha512-0jcXW7Xs/uzICrmgV3MhDYDeRy++1CqnpDIerlPIqYO4bhzB4WNbX/aRnQclustsAyTkFKB0z6rbcjmNg5tR8A==}
+ resolution: {integrity: sha512-ji0gd4kMYUxO+1fJBIbiBVRCjzG/lloiyCccnlebvb1ZJ5qXCPZqYg4Jl1DrrixnWNMKylzgpmMWx0yNDYXlzw==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
@@ -1510,8 +1510,8 @@ packages:
cpu: [x64]
os: [win32]
- resolution: {integrity: sha512-vvBzwu1pYQCp92maZCFCIw/XgOTMR5tur9GjakwIo2cmwRTMKajRZZDS9+e4KsUZWKu1E007WUeAFXRRjZeuzw==}
+ resolution: {integrity: sha512-WcTlaKt/TWkh5kUjdJcUmB1XgZ+1c6fz4Y9fDHL73YNSdGaUWjceeWrrlwF0nv19iABYWC4iAq1oX1w4Bn0vfg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
@@ -5915,8 +5915,8 @@ packages:
sass:
optional: true
- resolution: {integrity: sha512-/Ztf6CeRH+ejEXUrYtqI4gkS66eFIHuSwqi60RgcpWKodxFZx2/dqVCMKBwILfAHXQ+F1b1vAudgj3mnxqtoIA==}
+ resolution: {integrity: sha512-U7QEZaTini6wKrb8A8hqLLqYQyCetegKjCpJOyxk642vWoMoU1x5PyZCJFvgYgiptA8xc5j/9xYlZFO7w9Sjmw==}
engines: {node: '>=20.9.0'}
hasBin: true
peerDependencies:
@@ -8422,9 +8422,9 @@ snapshots:
'@next/[email protected]': {}
- '@next/[email protected]': {}
+ '@next/[email protected]': {}
dependencies:
source-map: 0.7.4
optionalDependencies:
@@ -8434,49 +8434,49 @@ snapshots:
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
optional: true
'@noble/[email protected]': {}
@@ -9852,7 +9852,7 @@ snapshots:
dependencies:
'@sentry/core': 10.70.0
dependencies:
'@opentelemetry/api': 1.9.1
'@rollup/plugin-commonjs': 28.0.1([email protected])
@@ -9866,7 +9866,7 @@ snapshots:
'@sentry/server-utils': 10.70.0
'@sentry/vercel-edge': 10.70.0
'@sentry/webpack-plugin': 5.4.0([email protected])([email protected]([email protected]))
rollup: 4.62.4
stacktrace-parser: 0.1.11
transitivePeerDependencies:
@@ -10313,9 +10313,9 @@ snapshots:
'@vercel/[email protected]': {}
optionalDependencies:
react: 19.2.8
'@vitest/[email protected]':
@@ -13059,14 +13059,14 @@ snapshots:
dependencies:
'@formatjs/intl-localematcher': 0.8.13
'@parcel/watcher': 2.6.0
'@swc/core': 1.15.47(@swc/[email protected])
icu-minify: 4.13.7
negotiator: 1.0.0
next-intl-swc-plugin-extractor: 4.13.7
po-parser: 2.2.0
react: 19.2.8
@@ -13103,9 +13103,9 @@ snapshots:
- '@babel/core'
- babel-plugin-macros
dependencies:
- '@next/env': 16.3.4
+ '@next/env': 16.3.8
'@swc/helpers': 0.5.23
baseline-browser-mapping: 2.11.22
caniuse-lite: 1.0.30001810
@@ -13114,14 +13114,14 @@ snapshots:
react-dom: 19.2.8([email protected])
styled-jsx: 5.1.6(@babel/[email protected])([email protected])
optionalDependencies:
- '@next/swc-darwin-arm64': 16.3.4
- '@next/swc-darwin-x64': 16.3.4
- '@next/swc-linux-arm64-gnu': 16.3.4
- '@next/swc-linux-arm64-musl': 16.3.4
- '@next/swc-linux-x64-gnu': 16.3.4
- '@next/swc-linux-x64-musl': 16.3.4
- '@next/swc-win32-arm64-msvc': 16.3.4
- '@next/swc-win32-x64-msvc': 16.3.4
+ '@next/swc-darwin-arm64': 16.3.8
+ '@next/swc-darwin-x64': 16.3.8
+ '@next/swc-linux-arm64-gnu': 16.3.8
+ '@next/swc-linux-arm64-musl': 16.3.8
+ '@next/swc-linux-x64-gnu': 16.3.8
+ '@next/swc-linux-x64-musl': 16.3.8
+ '@next/swc-win32-arm64-msvc': 16.3.8
+ '@next/swc-win32-x64-msvc': 16.3.8
'@opentelemetry/api': 1.9.1
'@playwright/test': 1.60.0
sharp: 0.35.4(@types/[email protected])
diff --git a/src/app/(components)/header/morphing-menu-icon.tsx b/src/app/(components)/header/morphing-menu-icon.tsx
index 66295f0..54e9edc 100644
--- a/src/app/(components)/header/morphing-menu-icon.tsx
+++ b/src/app/(components)/header/morphing-menu-icon.tsx
@@ -1,7 +1,8 @@
"use client";
-import { motion, useReducedMotion, type Transition } from "motion/react";
+import { motion, type Transition } from "motion/react";
+import { usePrefersReducedMotion } from "@/hooks/use-media-query";
import { cn } from "@/lib/utils";
const lineTransition = {
@@ -38,7 +39,7 @@ export function MorphingMenuIcon({
className,
"aria-hidden": ariaHidden = true,
}: MorphingMenuIconProps) {
- const prefersReducedMotion = useReducedMotion();
+ const prefersReducedMotion = usePrefersReducedMotion();
const transition = prefersReducedMotion ? { duration: 0 } : lineTransition;
diff --git a/src/app/(main)/(app)/components/home-seo-content.tsx b/src/app/(main)/(app)/components/home-seo-content.tsx
index 238a01f..348ceeb 100644
--- a/src/app/(main)/(app)/components/home-seo-content.tsx
+++ b/src/app/(main)/(app)/components/home-seo-content.tsx
@@ -8,6 +8,14 @@ import {
import { FaqAccordion, FaqAccordionItem } from "@/components/ui/faq-accordion";
import { STRIPE_TEMPLATE_PATHNAME } from "@/utils/invoice-app-url";
+import {
+ SeoContentHeading,
+ SeoContentLead,
+ SeoContentList,
+ SeoContentOrderedList,
+ SeoContentParagraph,
+} from "./seo-content-text";
+
/**
* Plain, server-rendered copy below the invoice editor on `/`.
*
@@ -28,13 +36,10 @@ export function HomeSeoContent() {
>
<div className="mx-auto max-w-3xl space-y-10 text-slate-800">
<div>
- <h2
- id="home-seo-content-heading"
- className="text-balance text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl"
- >
+ <SeoContentHeading id="home-seo-content-heading">
A free invoice generator that runs in your browser
- </h2>
- <p className="mt-4 text-pretty text-lg leading-relaxed">
+ </SeoContentHeading>
+ <SeoContentLead>
EasyInvoicePDF turns a short form into a PDF invoice. Type your
details, your client&apos;s and the line items, and the preview
redraws as you go. Download the PDF when it looks right. There is{" "}
@@ -46,8 +51,8 @@ export function HomeSeoContent() {
</Link>
, and the invoice is built on your own machine, so nothing you type
is uploaded.
- </p>
- <p className="mt-4 text-pretty text-lg leading-relaxed">
+ </SeoContentLead>
+ <SeoContentLead>
It is free, has no ads, and the{" "}
<Link
href="/open-source-invoice-generator"
@@ -56,14 +61,12 @@ export function HomeSeoContent() {
source code is open
</Link>{" "}
under AGPL-3.0, so you can read it or host your own copy.
- </p>
+ </SeoContentLead>
</div>
<div>
- <h2 className="text-balance text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl">
- How to create an invoice
- </h2>
- <ol className="mt-4 list-decimal space-y-2 pl-6 text-base">
+ <SeoContentHeading>How to create an invoice</SeoContentHeading>
+ <SeoContentOrderedList>
{HOW_TO_STEPS.map((step) => {
return (
<li key={step} className="text-pretty">
@@ -71,14 +74,12 @@ export function HomeSeoContent() {
</li>
);
})}
- </ol>
+ </SeoContentOrderedList>
</div>
<div>
- <h2 className="text-balance text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl">
- What goes on the invoice
- </h2>
- <ul className="mt-4 list-disc space-y-2 pl-6 text-base">
+ <SeoContentHeading>What goes on the invoice</SeoContentHeading>
+ <SeoContentList>
<li className="text-pretty">
Labels in{" "}
<Link
@@ -115,18 +116,16 @@ export function HomeSeoContent() {
Stripe-style invoice template
</a>
</li>
- </ul>
- <p className="mt-4 text-pretty text-base leading-relaxed">
+ </SeoContentList>
+ <SeoContentParagraph>
Your details stay saved in your browser, so the next invoice starts
filled in. To send it, download the PDF or share a link that opens
the same invoice.
- </p>
+ </SeoContentParagraph>
</div>
<div>
- <h2 className="mb-3 text-balance text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl">
- FAQ
- </h2>
+ <SeoContentHeading className="mb-3">FAQ</SeoContentHeading>
<FaqAccordion>
{FAQ.map((item) => {
return (
@@ -139,10 +138,8 @@ export function HomeSeoContent() {
</div>
<div>
- <h2 className="text-balance text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl">
- Invoices for every kind of work
- </h2>
- <ul className="mt-4 grid grid-cols-1 gap-x-6 gap-y-2 text-base sm:grid-cols-2">
+ <SeoContentHeading>Invoices for every kind of work</SeoContentHeading>
+ <ul className="mt-4 grid grid-cols-1 gap-x-6 gap-y-2 text-sm sm:grid-cols-2 sm:text-base">
{USE_CASE_LINKS.map(({ href, label }) => {
return (
<li key={href}>
diff --git a/src/app/(main)/(app)/components/seo-content-text.tsx b/src/app/(main)/(app)/components/seo-content-text.tsx
new file mode 100644
index 0000000..35e29af
--- /dev/null
+++ b/src/app/(main)/(app)/components/seo-content-text.tsx
@@ -0,0 +1,79 @@
+import type { ReactNode } from "react";
+
+import { cn } from "@/lib/utils";
+
+/*
+ * Text building blocks for the crawlable copy below the editor, `HomeSeoContent` on `/`
+ * and `StripeTemplateSeoContent` on `/stripe-template`, so the two sections share one
+ * type scale.
+ *
+ * Smaller on phones. Every size steps up at `sm` (headings once more at `md`), so headings
+ * and body text never sit at mismatched sizes between breakpoints.
+ */
+
+export function SeoContentHeading({
+ id,
+ className,
+ children,
+}: SeoContentHeadingProps) {
+ return (
+ <h2
+ id={id}
+ className={cn(
+ "text-balance text-xl font-semibold tracking-tight text-slate-900 sm:text-2xl md:text-3xl",
+ className,
+ )}
+ >
+ {children}
+ </h2>
+ );
+}
+
+/** The opening paragraphs under a section's first heading, a step larger than body text. */
+export function SeoContentLead({ children }: SeoContentChildrenProps) {
+ return (
+ <p className="mt-4 text-pretty text-base leading-relaxed sm:text-lg">
+ {children}
+ </p>
+ );
+}
+
+/** Body copy. Spaced like the other blocks; pass `className` to change the top margin. */
+export function SeoContentParagraph({
+ className,
+ children,
+}: SeoContentParagraphProps) {
+ return (
+ <p
+ className={cn(
+ "mt-4 text-pretty text-sm leading-relaxed sm:text-base",
+ className,
+ )}
+ >
+ {children}
+ </p>
+ );
+}
+
+export function SeoContentList({ children }: SeoContentChildrenProps) {
+ return <ul className={cn("list-disc", LIST_CLASS_NAME)}>{children}</ul>;
+}
+
+export function SeoContentOrderedList({ children }: SeoContentChildrenProps) {
+ return <ol className={cn("list-decimal", LIST_CLASS_NAME)}>{children}</ol>;
+}
+
+const LIST_CLASS_NAME = "mt-4 space-y-2 pl-6 text-sm sm:text-base";
+
+interface SeoContentChildrenProps {
+ children: ReactNode;
+}
+
+interface SeoContentHeadingProps extends SeoContentChildrenProps {
+ id?: string;
+ className?: string;
+}
+
+interface SeoContentParagraphProps extends SeoContentChildrenProps {
+ className?: string;
+}
diff --git a/src/app/(main)/(app)/components/stripe-template-seo-content.tsx b/src/app/(main)/(app)/components/stripe-template-seo-content.tsx
index a0ddcf8..0308e6e 100644
--- a/src/app/(main)/(app)/components/stripe-template-seo-content.tsx
+++ b/src/app/(main)/(app)/components/stripe-template-seo-content.tsx
@@ -3,6 +3,13 @@ import Link from "next/link";
import { SUPPORTED_INVOICE_PDF_LANGUAGES } from "@/app/schema";
import { FaqAccordion, FaqAccordionItem } from "@/components/ui/faq-accordion";
+import {
+ SeoContentHeading,
+ SeoContentLead,
+ SeoContentList,
+ SeoContentOrderedList,
+ SeoContentParagraph,
+} from "./seo-content-text";
import { StripeTemplateSwitchSentence } from "./stripe-template-switch-sentence";
/**
@@ -27,20 +34,17 @@ export function StripeTemplateSeoContent() {
>
<div className="mx-auto max-w-3xl space-y-10 text-slate-800">
<div>
- <h2
- id="stripe-template-seo-content-heading"
- className="text-balance text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl"
- >
+ <SeoContentHeading id="stripe-template-seo-content-heading">
A free Stripe-style invoice template
- </h2>
- <p className="mt-4 text-pretty text-lg leading-relaxed">
+ </SeoContentHeading>
+ <SeoContentLead>
The Stripe invoice template follows the layout of the invoices
Stripe sends. The amount due and its due date sit in bold above a
single table of line items, with a short summary of totals below.
Fill in the form and the preview redraws as you type, then download
the PDF.
- </p>
- <p className="mt-4 text-pretty text-lg leading-relaxed">
+ </SeoContentLead>
+ <SeoContentLead>
You don&apos;t need a Stripe account. It is a layout you fill in,
not a payments service: no products to set up and no dashboard. The
invoice is built in your browser, and{" "}
@@ -51,14 +55,12 @@ export function StripeTemplateSeoContent() {
there is no signup
</Link>
.
- </p>
+ </SeoContentLead>
</div>
<div>
- <h2 className="text-balance text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl">
- What&apos;s on the template
- </h2>
- <ul className="mt-4 list-disc space-y-2 pl-6 text-base">
+ <SeoContentHeading>What&apos;s on the template</SeoContentHeading>
+ <SeoContentList>
{TEMPLATE_PARTS.map((part) => {
return (
<li key={part} className="text-pretty">
@@ -76,14 +78,14 @@ export function StripeTemplateSeoContent() {
</Link>
, with your own tax label such as VAT, GST or Sales Tax
</li>
- </ul>
+ </SeoContentList>
</div>
<div>
- <h2 className="text-balance text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl">
+ <SeoContentHeading>
How to fill in the Stripe invoice template
- </h2>
- <ol className="mt-4 list-decimal space-y-2 pl-6 text-base">
+ </SeoContentHeading>
+ <SeoContentOrderedList>
{HOW_TO_STEPS.map((step) => {
return (
<li key={step} className="text-pretty">
@@ -91,14 +93,14 @@ export function StripeTemplateSeoContent() {
</li>
);
})}
- </ol>
- <StripeTemplateSwitchSentence />
+ </SeoContentOrderedList>
+ <SeoContentParagraph>
+ <StripeTemplateSwitchSentence />
+ </SeoContentParagraph>
</div>
<div>
- <h2 className="mb-3 text-balance text-2xl font-semibold tracking-tight text-slate-900 md:text-3xl">
- FAQ
- </h2>
+ <SeoContentHeading className="mb-3">FAQ</SeoContentHeading>
<FaqAccordion>
{FAQ.map((item) => {
return (
@@ -108,7 +110,7 @@ export function StripeTemplateSeoContent() {
);
})}
</FaqAccordion>
- <p className="mt-6 text-pretty text-base leading-relaxed">
+ <SeoContentParagraph className="mt-6">
Comparing it with billing through Stripe itself? See the{" "}
<Link
href="/stripe-invoice-alternative"
@@ -117,7 +119,7 @@ export function StripeTemplateSeoContent() {
Stripe invoice generator
</Link>{" "}
page.
- </p>
+ </SeoContentParagraph>
</div>
</div>
</section>
diff --git a/src/app/(main)/(app)/components/stripe-template-switch-sentence.tsx b/src/app/(main)/(app)/components/stripe-template-switch-sentence.tsx
index 051a33b..5631e36 100644
--- a/src/app/(main)/(app)/components/stripe-template-switch-sentence.tsx
+++ b/src/app/(main)/(app)/components/stripe-template-switch-sentence.tsx
@@ -9,7 +9,8 @@ import {
/**
* The "switch template" sentence in `StripeTemplateSeoContent`, the one line of that block
- * that depends on the template in use.
+ * that depends on the template in use. Only the words are client-rendered: the paragraph
+ * around them is the server-rendered `SeoContentParagraph` in `StripeTemplateSeoContent`.
*
* A template switch rewrites the address bar with `history.replaceState` and leaves the
* server-rendered copy alone, so after switching to the classic template a static "switch
@@ -24,7 +25,7 @@ export function StripeTemplateSwitchSentence() {
const pathname = usePathname();
return getRouteTemplate(pathname) === "stripe" ? (
- <p className="mt-4 text-pretty text-base leading-relaxed">
+ <>
Prefer a plainer A4 layout? Switch to the{" "}
{/* an explicit template: a bare `/` sends a visitor whose saved invoice uses this
template straight back here */}
@@ -36,9 +37,9 @@ export function StripeTemplateSwitchSentence() {
classic invoice template
</a>
. Your details carry over.
- </p>
+ </>
) : (
- <p className="mt-4 text-pretty text-base leading-relaxed">
+ <>
Want the Stripe layout back? Switch to the{" "}
<a
href={STRIPE_TEMPLATE_PATHNAME}
@@ -47,6 +48,6 @@ export function StripeTemplateSwitchSentence() {
Stripe invoice template
</a>
. Your details carry over.
- </p>
+ </>
);
}
diff --git a/src/app/(main)/(seo-landings)/build-seo-landing-json-ld.ts b/src/app/(main)/(seo-landings)/build-seo-landing-json-ld.ts
index cb1c2f4..3ac356e 100644
--- a/src/app/(main)/(seo-landings)/build-seo-landing-json-ld.ts
+++ b/src/app/(main)/(seo-landings)/build-seo-landing-json-ld.ts
@@ -10,12 +10,22 @@ import {
pageWebPageId,
} from "@/lib/seo/json-ld-ids";
-import type { SeoLandingDefinition } from "./seo-landing-definitions";
+import type {
+ SeoLandingDefinition,
+ SeoLandingHeroVideo,
+} from "./seo-landing-definitions";
-function buildLandingSoftwareApplication(
- pageUrl: string,
- definition: SeoLandingDefinition,
-) {
+interface BuildLandingSoftwareApplicationParams {
+ /** The landing's absolute URL, which also scopes the app's `@id`. */
+ pageUrl: string;
+ /** The landing whose title and description describe the app. */
+ definition: SeoLandingDefinition;
+}
+
+function buildLandingSoftwareApplication({
+ pageUrl,
+ definition,
+}: BuildLandingSoftwareApplicationParams) {
return {
"@type": "SoftwareApplication" as const,
"@id": pageSoftwareAppId(pageUrl),
@@ -36,6 +46,13 @@ function buildLandingSoftwareApplication(
};
}
+interface BuildLandingVideoParams {
+ /** The landing's absolute URL; the video is declared part of its `WebPage`. */
+ pageUrl: string;
+ /** The clip shown in the landing's hero. */
+ heroVideo: SeoLandingHeroVideo;
+}
+
/**
* The hero demo as a `VideoObject`.
*
@@ -50,10 +67,7 @@ function buildLandingSoftwareApplication(
*
* @see https://developers.google.com/search/docs/appearance/structured-data/video
*/
-function buildLandingVideo(
- pageUrl: string,
- heroVideo: NonNullable<SeoLandingDefinition["hero"]["heroVideo"]>,
-) {
+function buildLandingVideo({ pageUrl, heroVideo }: BuildLandingVideoParams) {
return {
"@type": "VideoObject" as const,
name: heroVideo.title,
@@ -128,10 +142,10 @@ export function buildSeoLandingJsonLd(
const graph = [
webPage,
...(isOpenSourceLanding
- ? [buildLandingSoftwareApplication(pageUrl, definition)]
+ ? [buildLandingSoftwareApplication({ pageUrl, definition })]
: []),
faqPage,
- ...(heroVideo ? [buildLandingVideo(pageUrl, heroVideo)] : []),
+ ...(heroVideo ? [buildLandingVideo({ pageUrl, heroVideo })] : []),
breadcrumb,
];
diff --git a/src/app/(main)/(seo-landings)/components/seo-landing-shell.tsx b/src/app/(main)/(seo-landings)/components/seo-landing-shell.tsx
index 10761f6..c0bbdee 100644
--- a/src/app/(main)/(seo-landings)/components/seo-landing-shell.tsx
+++ b/src/app/(main)/(seo-landings)/components/seo-landing-shell.tsx
@@ -151,13 +151,13 @@ export function SeoLandingShell({ definition }: SeoLandingShellProps) {
<div className="mt-8">
<a href={definition.hero.ctaHref}>
<img
- src={definition.hero.heroImage}
+ src={definition.hero.heroImage.src}
alt={definition.hero.h1}
className="h-auto w-full rounded-lg bg-slate-100/80 shadow-sm"
loading="eager"
fetchPriority="high"
- width={1920}
- height={1536}
+ width={definition.hero.heroImage.width}
+ height={definition.hero.heroImage.height}
/>
</a>
</div>
diff --git a/src/app/(main)/(seo-landings)/seo-landing-definitions.ts b/src/app/(main)/(seo-landings)/seo-landing-definitions.ts
index 327c52c..ece9280 100644
--- a/src/app/(main)/(seo-landings)/seo-landing-definitions.ts
+++ b/src/app/(main)/(seo-landings)/seo-landing-definitions.ts
@@ -96,37 +96,7 @@ export interface SeoLandingDefinition {
label: string;
files: { label: string; href: string }[];
};
- /**
- * Shown in the hero, and used as the poster frame when {@link heroVideo} is set.
- */
- heroImage: string;
- /**
- * An optional demo to show in the hero instead of the still image.
- *
- * Every field is here because Google's video rich results need it: the landing's
- * JSON-LD graph turns this into a `VideoObject`, and a clip embedded in an iframe is
- * otherwise invisible to both search engines and answer engines.
- */
- heroVideo?: {
- /**
- * `https://www.youtube.com/embed/<id>`, what the iframe loads and what the
- * `VideoObject` declares. There is no `contentUrl` alongside it: that property is
- * for the video file's own bytes, which YouTube never hands out.
- */
- embedUrl: string;
- /** The video's own title, as published. */
- title: string;
- /** One sentence on what the clip shows. */
- description: string;
- /** Publication timestamp, ISO 8601. Required for video rich results. */
- uploadDate: string;
- /**
- * Poster frame, e.g. `https://i.ytimg.com/vi/<id>/maxresdefault.jpg`. Spelled out
- * rather than derived from {@link embedUrl}: it must name the same video id.
- */
- thumbnailUrl: string;
- };
- };
+ } & SeoLandingHeroMedia;
sections: SeoSection[];
/**
* A short table of plain facts, shown directly under the hero.
@@ -150,6 +120,78 @@ export interface SeoLandingDefinition {
relatedSlugs: readonly SeoLandingSlug[];
}
+/**
+ * What fills the hero under the CTA: a still image or a demo clip, never both. The shell
+ * renders one or the other, so a definition that set both would carry an image nobody sees.
+ */
+type SeoLandingHeroMedia =
+ | {
+ /** Screenshot of the generator, linked to the CTA. */
+ heroImage: SeoLandingHeroImage;
+ heroVideo?: never;
+ }
+ | {
+ heroImage?: never;
+ heroVideo: SeoLandingHeroVideo;
+ };
+
+/**
+ * A hero screenshot with its intrinsic size. The `<img>` gets these as `width`/`height`,
+ * so the browser reserves a box of the right shape before the file arrives; a size that
+ * doesn't match the file shifts the page when it loads.
+ */
+interface SeoLandingHeroImage {
+ src: string;
+ width: number;
+ height: number;
+}
+
+/**
+ * A demo shown in the hero instead of a still image.
+ *
+ * Every field is here because Google's video rich results need it: the landing's
+ * JSON-LD graph turns this into a `VideoObject`, and a clip embedded in an iframe is
+ * otherwise invisible to both search engines and answer engines.
+ */
+export interface SeoLandingHeroVideo {
+ /**
+ * `https://www.youtube.com/embed/<id>`, what the iframe loads and what the
+ * `VideoObject` declares. There is no `contentUrl` alongside it: that property is
+ * for the video file's own bytes, which YouTube never hands out.
+ */
+ embedUrl: string;
+ /** The video's own title, as published. */
+ title: string;
+ /** One sentence on what the clip shows. */
+ description: string;
+ /** Publication timestamp, ISO 8601. Required for video rich results. */
+ uploadDate: string;
+ /**
+ * Poster frame, e.g. `https://i.ytimg.com/vi/<id>/maxresdefault.jpg`. Spelled out
+ * rather than derived from {@link SeoLandingHeroVideo.embedUrl}: it must name the same
+ * video id.
+ */
+ thumbnailUrl: string;
+}
+
+const DEFAULT_TEMPLATE_HERO_IMAGE = {
+ src: `${STATIC_ASSETS_URL}/seo-content/default-template-v1.png`,
+ width: 1920,
+ height: 1536,
+} as const satisfies SeoLandingHeroImage;
+
+const STRIPE_TEMPLATE_HERO_IMAGE = {
+ src: `${STATIC_ASSETS_URL}/seo-content/stripe-template-v1.png`,
+ width: 1920,
+ height: 1536,
+} as const satisfies SeoLandingHeroImage;
+
+const FREELANCE_HERO_IMAGE = {
+ src: `${STATIC_ASSETS_URL}/seo-content/def-tmp-v2-new.png`,
+ width: 2400,
+ height: 1350,
+} as const satisfies SeoLandingHeroImage;
+
/** The invoice app, opened on the visitor's last used template (default for new visitors). */
const APP_HREF = "/";
@@ -191,7 +233,6 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create and Download a PDF",
ctaHref: APP_HREF,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/default-template-v1.png`,
heroVideo: {
embedUrl: VIDEO_DEMO_HERO_YOUTUBE_URL,
title: "EasyInvoicePDF: Full demo #invoice #oss #freelancelife",
@@ -392,7 +433,6 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create and Download a PDF",
ctaHref: APP_HREF,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/str-tmp-v2.png`,
heroVideo: {
embedUrl: VIDEO_LIVE_PREVIEW_YOUTUBE_URL,
title: "EasyInvoicePDF: Live PDF Preview #invoice #oss #freelancelife",
@@ -572,7 +612,7 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create a Stripe-Style Invoice",
ctaHref: STRIPE_TEMPLATE_PATHNAME,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/stripe-template-v1.png`,
+ heroImage: STRIPE_TEMPLATE_HERO_IMAGE,
},
factsTable: {
heading: "What you get, and what you do not",
@@ -760,7 +800,6 @@ export const SEO_LANDING_DEFINITIONS = {
},
],
},
- heroImage: `${STATIC_ASSETS_URL}/seo-content/def-tmp-v2.png`,
heroVideo: {
embedUrl: VIDEO_DEMO_HERO_YOUTUBE_URL,
title: "EasyInvoicePDF: Full demo #invoice #oss #freelancelife",
@@ -989,7 +1028,6 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Invoice in Your Language",
ctaHref: APP_HREF,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/default-template-v1.png`,
heroVideo: {
embedUrl: VIDEO_MULTI_LANGUAGE_YOUTUBE_URL,
title:
@@ -1206,7 +1244,6 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create a Swedish Invoice",
ctaHref: APP_HREF,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/default-template-v1.png`,
heroVideo: {
embedUrl: VIDEO_NORDIC_INVOICE_YOUTUBE_URL,
title: "EasyInvoicePDF: Swedish and Norwegian Invoice Generator",
@@ -1417,7 +1454,6 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create a Norwegian Invoice",
ctaHref: APP_HREF,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/default-template-v1.png`,
heroVideo: {
embedUrl: VIDEO_NORDIC_INVOICE_YOUTUBE_URL,
title: "EasyInvoicePDF: Swedish and Norwegian Invoice Generator",
@@ -1627,7 +1663,6 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create a Spanish Invoice",
ctaHref: APP_HREF,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/default-template-v1.png`,
heroVideo: {
embedUrl: VIDEO_MULTI_LANGUAGE_YOUTUBE_URL,
title:
@@ -1816,7 +1851,6 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create a German Invoice",
ctaHref: APP_HREF,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/default-template-v1.png`,
heroVideo: {
embedUrl: VIDEO_MULTI_LANGUAGE_YOUTUBE_URL,
title:
@@ -2011,7 +2045,7 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create a Contractor Invoice",
ctaHref: APP_HREF,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/default-template-v1.png`,
+ heroImage: DEFAULT_TEMPLATE_HERO_IMAGE,
},
factsTable: {
heading: "A US contractor invoice at a glance",
@@ -2185,7 +2219,7 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create a Freelance Invoice",
ctaHref: APP_HREF,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/def-tmp-v2.png`,
+ heroImage: FREELANCE_HERO_IMAGE,
},
factsTable: {
heading: "Freelance invoices at a glance",
@@ -2341,7 +2375,7 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create a Proforma Invoice",
ctaHref: STRIPE_TEMPLATE_PATHNAME,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/stripe-template-v1.png`,
+ heroImage: STRIPE_TEMPLATE_HERO_IMAGE,
},
factsTable: {
heading: "Proforma invoices at a glance",
@@ -2504,7 +2538,7 @@ export const SEO_LANDING_DEFINITIONS = {
],
ctaLabel: "Create an Export Invoice",
ctaHref: APP_HREF,
- heroImage: `${STATIC_ASSETS_URL}/seo-content/default-template-v1.png`,
+ heroImage: DEFAULT_TEMPLATE_HERO_IMAGE,
},
factsTable: {
heading: "An export of services invoice at a glance",
diff --git a/src/hooks/use-media-query.tsx b/src/hooks/use-media-query.tsx
index a6cec98..a6c8e68 100644
--- a/src/hooks/use-media-query.tsx
+++ b/src/hooks/use-media-query.tsx
@@ -79,3 +79,13 @@ export const useIsDesktop = () => {
export const useIsXlUp = () => {
return useMediaQuery("(min-width: 1280px)");
};
+
+/**
+ * The device's Reduced Motion setting, kept live as it changes.
+ *
+ * In place of motion's `useReducedMotion`, which reads the setting once and logs a
+ * "You have Reduced Motion enabled" warning on every dev load where it is on.
+ */
+export const usePrefersReducedMotion = () => {
+ return useMediaQuery("(prefers-reduced-motion: reduce)");
+};