ShiftFast Docs

SEO & Metadata

Canonical URLs, sitemap, robots, and structured data.

SEO is handled centrally through src/lib/seo.ts, rather than each page building its own metadata from scratch.

Page metadata

buildPageMetadata() is called from every page's generateMetadata() and returns title, description, canonical URL, OpenGraph, and Twitter card tags in one shot:

buildPageMetadata({
  path: '/pricing',
  locale,
  title: 'Pricing',
  description: '...',
})

Because the app is localized, canonical URLs and OpenGraph URLs are built through buildCanonical(), which resolves the correct localized pathname via next-intl's getPathname() — see Internationalization.

Hreflang alternates

buildHreflangAlternates() generates an alternates.languages entry for every locale (plus x-default pointing at the default locale), so search engines know the en and fr versions of a page are translations of each other rather than duplicate content.

Sitemap and robots

  • src/app/robots.ts allows all crawling except /app, /*/app (the authenticated shell) and /api, and points at /sitemap.xml.
  • src/app/sitemap.ts combines a static path list with every locale (via the same hreflang-alternates helper), plus dynamic entries generated from docsSource.getPages() and blogSource.getPages() — new docs or blog pages appear in the sitemap automatically, with no manual list to maintain.

OpenGraph image

ogImageUrl(locale) points at src/app/[locale]/opengraph-image.tsx, which renders SITE_NAME/SITE_DESCRIPTION into a 1200×630 image at request time via next/og. See Customization to change it.

Structured data (JSON-LD)

src/lib/seo.ts exports these JSON-LD builders, each rendered via a shared <JsonLd> component:

BuilderUsed for
buildOrganizationJsonLd()Site-wide, in the root layout: your Organization and WebSite
buildSoftwareApplicationJsonLd(plans)The pricing page, listing each plan as an Offer
buildFaqJsonLd(faqs)The FAQ section
buildArticleJsonLd(post)Individual blog posts
buildTechArticleJsonLd(doc)Docs pages
buildBreadcrumbJsonLd(items)Blog posts and docs pages, with localized names and URLs

The Organization and WebSite get stable ids (/#organization, /#website), and the other builders reference them as publisher, seller, or parent site, so search engines see one connected entity instead of separate, unrelated descriptions. Add your official profiles (GitHub, X, LinkedIn, Product Hunt) to SITE_PROFILES in the same file: they become the Organization's sameAs links, which help search engines tell your brand apart from others with a similar name.

FAQ answers stay in the page HTML while collapsed (the accordion uses hiddenUntilFound), so crawlers and AI tools can read them and in-page search can open them. Google no longer shows FAQ rich results, but the markup still describes the page accurately.

All of this lives in one file. Adding a new marketing page mostly means calling buildPageMetadata() with the right path/title/description — you shouldn't need to hand-write <meta> tags or duplicate the canonical/hreflang logic per page.

On this page