← App|Global Music Trendsdocs

SEO

Goals


Implemented

metadataBase

Set in app/layout.tsx. Required for Next.js to resolve relative OG image URLs into absolute URLs.

metadataBase: new URL(process.env.NEXT_PUBLIC_SITE_URL ?? 'https://vercel-music.vercel.app')

Title template

title: { template: '%s — Global Music Trends', default: 'Global Music Trends' }

Per-page generateMetadata

FieldTrends pageArtist page
titleTrending in [Country]Artist name
descriptionTop trending tracks and artists in [Country]…First 155 chars of Last.fm bio
openGraph.typewebsiteprofile
openGraph.imagesGenerated OG imageArtist image from Last.fm
twitter.cardsummary_large_imagesummary_large_image or summary

Canonical URLs

Each page sets alternates.canonical to its own locale-prefixed path, preventing Google from choosing an arbitrary URL as canonical.

hreflang alternate links

Each page sets alternates.languages with an entry for every supported locale, telling Google that /en/trends/france and /fr/trends/france are translations of the same page, not duplicates.

JSON-LD structured data (artist pages)

Artist pages emit a MusicGroup schema block. Fields populated: name, description, image, url, genre. This enables rich results in Google Search.

Generated OG images

Both route types have a co-located opengraph-image.tsx (1200×630 PNG via next/og):

generateStaticParams (trends pages)

All locale × country combinations are pre-rendered at build time so crawlers always receive fully rendered HTML with no ISR wait on first visit.


Environment variable

VariablePurpose
NEXT_PUBLIC_SITE_URLAbsolute base URL used in metadataBase, canonical links, and OG image URLs. Must be set in Vercel project settings for production.

Not implemented / future work

ItemNotes
sitemap.xmlAdd with app/sitemap.ts enumerating all locale × country trend pages.
robots.txtAdd with app/robots.ts.
Artist generateStaticParamsNot feasible without a bounded artist list — ISR handles on-demand.
Breadcrumb structured dataCould improve SERP display.
OG image with artist photoFetch Last.fm image inside opengraph-image.tsx and composite it.