# Continuous reading

Read successive topics without an infinitely growing document. Each article has
its own URL, sidebar entry, search result, and Markdown export. A deliberate
scroll at the end moves to the next route and retires the previous article.

## Configure page loaders

Continuous reading is on by default for eligible static MDX pages. Supply lazy
loaders alongside metadata:

```ts

initDocs({
  site: {},
  pageMetadata: import.meta.glob('./pages/**/+Page.mdx', {
    eager: true, query: '?frontmatter', import: 'default',
  }),
  pageLoaders: import.meta.glob<Awaited<ReturnType>>('./pages/**/+Page.mdx'),
  sectionOrder: ['Foundations', 'Interaction', 'Patterns'],
})
```

There is no reader toggle. Set `site.continuousReading: false` to disable the
gesture for a site. Pages without loaders retain ordinary previous/next links.

## At the end of an article

When previous/next navigation is reached, it stays at the bottom of the reading
viewport without a dividing rule. Pause briefly, then scroll again: the next
card expands to reading width and its frame dissolves. On touch screens, start
a fresh upward drag at the boundary. Arrival momentum alone does not advance.
Reversing the gesture, releasing an incomplete touch drag, or pressing Escape
cancels partial progress. Scrollable examples and form controls keep their input.

The next article emerges during a short visual transition where supported.
Reduced motion uses an immediate route handoff. Ordinary clicks, modifier-clicks
and keyboard activation of the navigation links still work. Loading failures
retain the current article and offer Retry plus the normal next-page link.

## Routes, headings, and history

Only one live article is rendered. The current TOC heading indicator stays on
the outgoing article during the gesture. At commit, the router changes the URL,
sidebar, title, headings and TOC together and resets the new page's scroll origin.
The outgoing article is removed; a transition may briefly retain a visual snapshot.

Each committed transition adds one ordinary history entry. Back and Forward use
the router's normal page and scroll restoration. Heading links and TOC clicks
use the current article's canonical URL and hash. No cumulative document scroll
or duplicate heading IDs are needed. Each route keeps its own server rendering
and Pagefind index entry.

## Order and boundaries

Reading follows sidebar section order, then each page's frontmatter `order`.
It stays in the current topbar tab and excludes hidden, noindex, and fullscreen
pages. A page without a lazy loader is a boundary. Supply static MDX modules;
server-data routes requiring their own page props are not gesture destinations.
The ordinary navigation links remain available at reading boundaries.
