Compatibility
The current adapter targets SvelteKit 2 with Svelte 5. The acceptance fixture uses SvelteKit2.70.2, Svelte 5.56.8, and Vite 8.2.0. SvelteKit 1 and
Svelte 4 are outside the current tested boundary.
Configure the runtime
fimo-sveltekit at the same version as fimo. It carries every SvelteKit surface: content, labels, components, the Vite plugin, and the hosting adapter.
- npm
- Bun
- pnpm
- Yarn
Content and labels
Use SvelteKit serverload functions with the request event:
createFimo the locale your application resolved. If you omit it, Fimo
sends i18n.defaultLocale from .fimo/config.json, and when that is unset the
API answers with your site default.
getLabels follows the same rule: add locale once your application resolves
one, and without it the API answers with your site default, which the
returned snapshot reports as its locale. Fetch labels in the root server layout
and pass the snapshot to FimoProvider. Fimo resolves the injected content API
URL internally. A server runtime URL takes precedence over the build-time URL.
Use getLabels directly so the same code works in local development and on
Fimo hosting:
fimo-sveltekit/components:
SEO defaults
Resolve SEO in the existing server load and returnseoHead. Preserve the
load’s other data, including labels. A content page resolves after its read:
resolveSeoForPath(event.url.pathname, config, { article }), applies app
overrides, and returns its complete seoHead using toSeoHead.
seoHead replaces the default head as a whole.
siteSchemas: buildSiteSchemas(seo).map(serializeJsonLd)
from the root load and render each entry in the same <svelte:head> with
{@html `<script type="application/ld+json">${schema}</script>`}. This is
the site’s Organization and WebSite JSON-LD; it stays empty until the SEO
settings have a site name and URL.
New projects also serve /robots.txt and /sitemap.xml from
src/routes/robots.txt/+server.ts and src/routes/sitemap.xml/+server.ts.
Both files use the site’s address and are built when the site publishes. The
sitemap lists the pages declared in .fimo/config.json#routes; add the pages it
cannot list to the route. A site with no address yet has an empty sitemap, and
its robots.txt names none.
Do not add a second page title beside root social tags. Use the same final
values for all tags and check client navigation, including returning to a page
without overrides. Existing apps can keep their current head component and
extend it in place.
The example canonical policy fits a root-hosted site; preserve existing
production domains, base paths and trailing slashes. Imported config needs
sync and rebuild/redeploy.
The starter’s root +layout.server.ts sets prerender = true, so every page is
built when the site publishes and visits never query the site’s database.
Content edits reach the live site with the next publish either way. Set
prerender = false only on a route that needs per-visitor data or a form
action. See database compute.
Live preview
FimoProvider also owns the optional Studio preview runtime, including script
loading, SvelteKit navigation, and content refresh. Application code does not
need a Fimo server hook, a separate preview component, a preview environment
lookup, or a script tag.
Boundaries
- SvelteKit owns routing, history, 404s, locale URLs, and per-page SEO; the root layout renders Fimo’s site-wide SEO defaults.
- Fimo’s Vite plugin supplies the public content API URL at build time and tags sources during development.
FimoProviderowns labels and the optional Studio preview bridge.- Do not add React, React Query, or a Vite SPA fallback to SvelteKit.