@sanity/routes
    Preparing search index...

    Interface GetRedirectsOptions

    Options for getRedirects.

    interface GetRedirectsOptions {
        cacheTtl?: number;
        source?: "auto" | "manual";
    }
    Index

    Properties

    Properties

    cacheTtl?: number

    Cache TTL in milliseconds. When set, results are cached in memory and returned from cache until the TTL expires.

    Use this in server hooks or middleware where getRedirects() is called on every request. Without caching, each request triggers a Sanity API call.

    // SvelteKit hooks.server.ts — cached for 60 seconds
    const redirects = await getRedirects(client, { cacheTtl: 60_000 })

    // Next.js next.config.js — no cache needed (runs at build time)
    const redirects = await getRedirects(client)
    source?: "auto" | "manual"

    Filter by redirect source: 'auto' (slug changes) or 'manual' (editor-created).