Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

510 B
Raw Blame
import type { APIRoute } from 'astro';
import { DOCS_LOCALES } from '../../docs/docs.constants';
import { createRedirectionToLocalizedPage } from '../../i18n/i18n.routes';

export const prerender = false;

// Matches both /docs and /docs/*, keeping deep links intact during locale negotiation.
export const GET: APIRoute = ({ preferredLocaleList, url }) =>
  createRedirectionToLocalizedPage(({ locale }) => `/${locale}${url.pathname}${url.search}`, {
    locales: DOCS_LOCALES,
  })({ preferredLocaleList });