Free auditStart free
GuideSvelteKit · Metadata

SvelteKit title tags and meta descriptions

Set unique SvelteKit titles and descriptions with load data and svelte:head, then verify server-rendered HTML on dynamic routes.

4 min
read
5
sources
Oct 24, 2026
updated
Scaplet Editorial Team
author
In one line

Return each route’s title and description from its load function, then render them in <svelte:head>. SvelteKit uses SSR by default, so the metadata can be in the initial HTML response. Keep the values unique for each route and inspect the deployed response instead of checking only the browser after JavaScript runs.

30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01Check it

Return route-specific metadata from load

Put page data in the route’s load function, then use it in <svelte:head>. This keeps a dynamic article’s metadata tied to the same record as its visible heading and body. SvelteKit’s SEO docs say every page should have well-written and unique <title> and <meta name="description"> elements inside <svelte:head>, and describe a common pattern: return SEO data from page load functions, then use it as page.data in a <svelte:head> in your root layout. The example below puts the tags in the page instead. Return a real 404 with error(404, ...) when the record does not exist.
+page.svelte
<script>
  let { data } = $props()
</script>

<svelte:head>
  <title>{data.title}</title>
  <meta name="description" content={data.description} />
</svelte:head>

<h1>{data.article.title}</h1>

The example uses a server load function so API credentials and server-only access can stay on the server. For public data, a universal +page.js load can also supply data. The important check is the rendered document: title and description should describe this route, not the entire site or a generic template.

+page.server.ts
import { error } from '@sveltejs/kit'

export async function load({ params, fetch }) {
  const response = await fetch(`/api/articles/${params.slug}`)
  if (!response.ok) error(404, 'Article not found')

  const article = await response.json()
  return {
    title: article.seoTitle ?? article.title,
    description: article.seoDescription ?? article.summary,
    article
  }
}
02Pick rendering based on how the page changes

Preserve server rendering for public search pages

SvelteKit renders pages on the server by default, and Svelte’s docs say that during server-side rendering head content is exposed separately to the main body content. SvelteKit’s SEO docs say server-rendered content is indexed more frequently and reliably, and that you should leave SSR on unless you have a good reason not to. A client-only metadata update can make the browser tab look correct while the initial response is missing the page’s title and description.
Page

Stable public page

Starting point
Prerender it when its content is known at build time.
Metadata check
Built HTML contains the route’s title and description.
Page

Public page with request-time data

Starting point
Use SSR and load data on the server.
Metadata check
A direct request returns the correct tags and visible content.
Page

Private account screen

Starting point
Use the rendering and access model the app needs.
Metadata check
The route is not accidentally listed as public content.
Page

Client-only app page

Starting point
Disable SSR only when browser-only behavior requires it.
Metadata check
Do not rely on a post-hydration head update as the only metadata source.

Per SvelteKit’s page options, any two users hitting a prerendered page directly must get the same content, and accessing url.searchParams during prerendering is forbidden. Child layouts and pages override values set in parent layouts, so you can enable prerendering for the app and disable it for pages that need dynamic rendering. See SvelteKit page options.

03Checklist

Make the metadata match the canonical route

First2
Use one descriptive title per route. Do not let a shared layout append the site name twice or overwrite a page-specific title.
Write a unique description that summarizes the page’s actual content.
Next2
If a route has query parameters for sorting or filtering, decide which URL is canonical and render that decision consistently.
Add alternate-language links only when equivalent translations exist.
Then1
If the CMS record is missing a title or summary, use a meaningful fallback rather than emitting undefined, an empty string, or metadata from another record.

By default SvelteKit removes trailing slashes by redirecting: visit /about/ and it responds with a redirect to /about. The trailingSlash page option can be 'never' (the default), 'always', or 'ignore', and the docs advise against 'ignore' because /x and /x/ become separate URLs. Make canonicals and internal links match the form your site uses. See canonical URLs and meta descriptions.

04How it works

Verify what a crawler receives

  1. 1

    Request a route directly

    Open a deep URL in a fresh tab or use curl -sL https://example.com/articles/example. A route that works only after navigating from the homepage may have a routing or server-data issue.

  2. 2

    Inspect the first response

    Search the response HTML for <title> and name="description". Confirm they describe the requested article before any client-side navigation.

  3. 3

    Test more than one slug

    Check two different records, a missing slug, and a record with blank SEO fields. This catches static metadata accidentally reused across a dynamic route family.

  4. 4

    Check canonical and redirects

    Test both trailing-slash forms. Confirm any canonical you render points at the final public URL and the redirect does not loop or add an extra hop.

For Google’s general guidance, see JavaScript SEO basics. A successful HTML check confirms output, not indexing; use URL Inspection and Search Console to investigate indexing separately.

Sources · 5

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • svelte.dev
  • google.com
  1. 01SEO | SvelteKit Docssvelte.dev · checked 2026-10-24
  2. 02Routing | SvelteKit Docssvelte.dev · checked 2026-10-24
  3. 03Page options | SvelteKit Docssvelte.dev · checked 2026-10-24
  4. 04<svelte:head> | Svelte Docssvelte.dev · checked 2026-10-24
  5. 05JavaScript SEO basics | Google Search Centraldevelopers.google.com · checked 2026-10-24
Questions

Asked a lot.

4 questions people ask next, answered from the sources on this page.

01Where do I set the title in SvelteKit?

Put a <title> inside <svelte:head>. For route-specific pages, return the title from load and render the returned data so each URL gets its own value.

02Why does my SvelteKit title show in the browser but not in view-source?

The title may be set only after client-side JavaScript runs, or SSR may be disabled for that route. SvelteKit uses SSR by default, so inspect the direct response and render the title through <svelte:head> with data from load.

03Can SvelteKit use dynamic metadata for CMS pages?

Yes. Load the CMS record from the route parameter and render its SEO fields through <svelte:head>. Add a fallback for missing fields, return a 404 for a missing record, and test two different URLs to catch reused metadata.

04Should every SvelteKit route be prerendered?

No. SvelteKit’s docs say a page is prerenderable only if any two users hitting it directly get the same content from the server, and that prerendered content is seen by all users. Pages with actions cannot be prerendered.

Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane