SPB Git forge

spb/fetcha

Public
11commits 1branches 0releases
1.5 MBsize
maindefault branch
16 days agolast push
TypeScript 97.5% SQL 1.4% Python 0.8%
2.0 KB · 64 lines typescript
Raw Blame History
1export interface DocsNavLink {2  title: string;3  href: string;4  /** External links open in the same tab but are excluded from prev/next navigation. */5  external?: boolean;6  badge?: "Coming soon" | "Beta";7}89export interface DocsNavSection {10  title: string;11  links: DocsNavLink[];12}1314export const DOCS_NAV: DocsNavSection[] = [15  {16    title: "Getting started",17    links: [18      { title: "Introduction", href: "/docs" },19      { title: "Quickstart", href: "/docs/quickstart" },20      { title: "Authentication", href: "/docs/authentication" },21    ],22  },23  {24    title: "Core API",25    links: [26      { title: "Fetch API", href: "/docs/fetch" },27      { title: "Network Selection", href: "/docs/networks" },28      { title: "Geolocation", href: "/docs/geolocation" },29      { title: "Sessions", href: "/docs/sessions" },30      { title: "Crawl & Map", href: "/docs/crawl" },31      { title: "Browser", href: "/docs/browser" },32      { title: "Extraction", href: "/docs/extraction", badge: "Coming soon" },33    ],34  },35  {36    title: "Reliability",37    links: [38      { title: "Errors", href: "/docs/errors" },39      { title: "Retries", href: "/docs/retries" },40      { title: "Webhooks", href: "/docs/webhooks", badge: "Coming soon" },41      { title: "Rate Limits", href: "/docs/rate-limits" },42    ],43  },44  {45    title: "Tools",46    links: [47      { title: "SDKs", href: "/docs/sdks" },48      { title: "Examples", href: "/docs/examples" },49      { title: "Changelog", href: "/changelog", external: true },50    ],51  },52];5354/** Flat, ordered list of internal doc pages (used for prev/next footers). */55export const DOCS_PAGES: DocsNavLink[] = DOCS_NAV.flatMap((s) => s.links).filter((l) => !l.external);5657export function getPrevNext(href: string): { prev: DocsNavLink | null; next: DocsNavLink | null } {58  const i = DOCS_PAGES.findIndex((p) => p.href === href);59  if (i === -1) return { prev: null, next: null };60  return { prev: DOCS_PAGES[i - 1] ?? null, next: DOCS_PAGES[i + 1] ?? null };61}6263export const DOCS_BASE_URL = "https://www.fetcha.co";64