Back to work

04 — Case study

Public product

Core Web Vitals and SEO

LCP tuning on the homepage hero, listing stability, and structured metadata on vehicle detail pages.

Role

Frontend Lead

Context

Caroline.id, automotive marketplace

Period

March 2022 – present

Stack

Next.js, Core Web Vitals, Lighthouse

01 — Problem

Homepage hero and vehicle detail pages dominated LCP, while listings needed stable titles and rich results without duplicate mobile and desktop SEO logic.

Hero imagery on the v2 homepage had to match preload width and quality between server render and client image loaders. Unit detail existed on desktop and mobile routes with middleware choosing layout; both still needed the same canonical URL, Open Graph image, and product structured data.

02 — Approach

  1. Align LCP with real request sizes

    Hero banner constants separate mobile and desktop request widths; a helper builds the same URL the LCP image uses so preload and rendered priority stay in sync. Gallery tests assert the first detail image is marked priority for LCP.

  2. One metadata generator for both PDP layouts

    Vehicle detail metadata loads car data once, builds title and description from live inventory, sets canonical to the public listing URL, and supplies OG images from CDN paths with a safe fallback image.

  3. Measure with repeatable Lighthouse scripts

    Package scripts run Lighthouse on mobile with several throttling presets and write JSON/HTML under a vitals folder so comparisons stay reproducible before chasing one-off field scores.

generateUnitDetailMetadata.ts
export async function generateUnitDetailMetadata({
params,
}: {
params: Promise<{ slug: string }>;
}): Promise<Metadata> {
const { slug } = await params;
const car = await fetchCarDetail(slug);
const title = buildSeoTitle(car);
const canonical = buildCanonicalUrl(slug);

return {
  title,
  description: buildDescription(title),
  alternates: { canonical },
  openGraph: { images: [pickHeroImage(car)] },
};
}
Fig. 1 — Shared metadata for desktop and mobile PDP. Illustrative excerpt, not production code.

03 — Where AI helped

AI helped sketch JSON-LD fields and lighthouse command flags; I verified schema fields against what the API actually returns and kept canonical rules aligned with middleware rewrites.

04 — Result

LCP work focused on the hero and first gallery image; SEO work centralized metadata and Product JSON-LD on listing routes. Before-and-after LCP and CLS figures will be published once you provide cleared measurements.

Next project