Skip to main content


Edit this page on GitHub

The most important aspect of SEO is to create high-quality content that is widely linked to from around the web. However, there are a few technical considerations for building sites that rank well.

Out of the boxpermalink


While search engines have got better in recent years at indexing content that was rendered with client-side JavaScript, server-side rendered content is indexed more frequently and reliably. SvelteKit employs SSR by default, and while you can disable it in handle, you should leave it on unless you have a good reason not to.

SvelteKit's rendering is highly configurable and you can implement dynamic rendering if necessary. It's not generally recommended, since SSR has other benefits beyond SEO.


Signals such as Core Web Vitals impact search engine ranking. Because Svelte and SvelteKit introduce minimal overhead, it's easier to build high performance sites. You can test your site's performance using Google's PageSpeed Insights or Lighthouse.

Normalized URLspermalink

SvelteKit redirects pathnames with trailing slashes to ones without (or vice versa depending on your configuration), as duplicate URLs are bad for SEO.

Manual setuppermalink

<title> and <meta>permalink

Every page should have well-written and unique <title> and <meta name="description"> elements inside a <svelte:head>. Guidance on how to write descriptive titles and descriptions, along with other suggestions on making content understandable by search engines, can be found on Google's Lighthouse SEO audits documentation.

A common pattern is to return SEO-related stuff from page load functions, then use it (as $page.stuff) in a <svelte:head> in your root layout.

Structured datapermalink

Structured data helps search engines understand the content of a page. If you're using structured data alongside svelte-preprocess, you will need to explicitly preserve ld+json data (this may change in future):

import preprocess from 'svelte-preprocess';
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: preprocess({
preserve: ['ld+json']
// ...
export default config;


Sitemaps help search engines prioritize pages within your site, particularly when you have a large amount of content. You can create a sitemap dynamically using an endpoint:

export async function GET() {
return {
headers: {
'Content-Type': 'application/xml'
body: `
<?xml version="1.0" encoding="UTF-8" ?>
<!-- <url> elements go here -->


An unfortunate reality of modern web development is that it is sometimes necessary to create an Accelerated Mobile Pages (AMP) version of your site. In SvelteKit this can be done by enforcing the following configuration options...

/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
// the combination of these options
// disables JavaScript
browser: {
hydrate: false,
router: false
// since <link rel="stylesheet"> isn't
// allowed, inline all styles
inlineStyleThreshold: Infinity
export default config;

...and transforming the HTML using transformPageChunk along with transform imported from @sveltejs/amp:

import * as amp from '@sveltejs/amp';
/** @type {import('@sveltejs/kit').Handle} */
export async function handle({ event, resolve }) {
let buffer = '';
return resolve(event, {
transformPageChunk: ({ html, done }) => {
buffer += html;
if (done) return amp.transform(html);

It's a good idea to use the handle hook to validate the transformed HTML using amphtml-validator, but only if you're prerendering pages since it's very slow.

previous Types
We stand with Ukraine. Donate → We stand with Ukraine. Petition your leaders. Show your support.