Framework integration

Rankveo for SvelteKit

Publish in rankveo, render on your SvelteKit site. Load functions, prerender entries, and XML endpoints - prerendered or server-rendered.
@rankveo/sveltekit

Installation

Install the package in your existing SvelteKit project.

terminal
npm install @rankveo/sveltekit

Three steps

1

Keep the client server-side

The .server suffix is what makes it unreachable from the browser.

// src/lib/rankveo.server.ts
import { BlogClient } from
  '@rankveo/sveltekit';
import { env } from
  '$env/dynamic/private';

export const blog = new BlogClient({
  apiKey: env.RANKVEO_BLOG_API_KEY,
});
2

Declare the entries

Every article, whether or not a page links to it.

export const prerender = true;

export const entries: EntryGenerator =
  async () => articleEntries(blog);
3

Load and render

An ordinary load function returning an ordinary object.

export const load = async (
  { params },
) => {
  const article =
    await blog.findArticle(params.slug);
  if (!article) error(404);
  return { article };
};

Written for prerendering

A prerendered page cannot read a query string - SvelteKit throws, because a static file cannot vary by one. So pagination lives in the path, and every page is its own crawlable URL.

  • Path-based pages /blog, /blog/2, /blog/tag/seo/2 - all real files.
  • Tags declared from the API Every tag route generated, not discovered by crawling.
  • Sitemap and RSS as endpoints Prerendered alongside everything else.
// svelte.config.js

export default {
  kit: {
    adapter: adapter(),
    prerender: {
      entries: [
        '/blog',
        '/blog/sitemap.xml',
      ],
    },
  },
};

Worth knowing before you start

Split server from client config Importing the client and your constants from one module makes SvelteKit refuse the build - correctly. The starter keeps them apart.
Link the sitemap, or declare it Nothing links a sitemap, so the crawler never finds it. Add it to prerender.entries or the build fails.
No framework-level invalidation SvelteKit has none, so freshness is your adapter’s business: a deploy hook when prerendered, a CDN purge when not.
Svelte 5 runes The starter components use runes and no UI library, so they drop into whatever you already run.