export interface DocsNavLink { title: string; href: string; /** External links open in the same tab but are excluded from prev/next navigation. */ external?: boolean; badge?: "Coming soon" | "Beta"; } export interface DocsNavSection { title: string; links: DocsNavLink[]; } export const DOCS_NAV: DocsNavSection[] = [ { title: "Getting started", links: [ { title: "Introduction", href: "/docs" }, { title: "Quickstart", href: "/docs/quickstart" }, { title: "Authentication", href: "/docs/authentication" }, ], }, { title: "Core API", links: [ { title: "Fetch API", href: "/docs/fetch" }, { title: "Network Selection", href: "/docs/networks" }, { title: "Geolocation", href: "/docs/geolocation" }, { title: "Sessions", href: "/docs/sessions" }, { title: "Crawl & Map", href: "/docs/crawl" }, { title: "Browser", href: "/docs/browser" }, { title: "Extraction", href: "/docs/extraction", badge: "Coming soon" }, ], }, { title: "Reliability", links: [ { title: "Errors", href: "/docs/errors" }, { title: "Retries", href: "/docs/retries" }, { title: "Webhooks", href: "/docs/webhooks", badge: "Coming soon" }, { title: "Rate Limits", href: "/docs/rate-limits" }, ], }, { title: "Tools", links: [ { title: "SDKs", href: "/docs/sdks" }, { title: "Examples", href: "/docs/examples" }, { title: "Changelog", href: "/changelog", external: true }, ], }, ]; /** Flat, ordered list of internal doc pages (used for prev/next footers). */ export const DOCS_PAGES: DocsNavLink[] = DOCS_NAV.flatMap((s) => s.links).filter((l) => !l.external); export function getPrevNext(href: string): { prev: DocsNavLink | null; next: DocsNavLink | null } { const i = DOCS_PAGES.findIndex((p) => p.href === href); if (i === -1) return { prev: null, next: null }; return { prev: DOCS_PAGES[i - 1] ?? null, next: DOCS_PAGES[i + 1] ?? null }; } export const DOCS_BASE_URL = "https://www.fetcha.co";