Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/content/docs/en/reference/routing-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ export async function getStaticPaths({ paginate }) {
const allPokemon = result.results;

// Return a paginated collection of paths for all items
return paginate(allPokemon, { pageSize: 10 });
return paginate(allPokemon, {
pageSize: 10,
format: (url) => `${url}.html`
});
}

const { page } = Astro.props;
Expand All @@ -240,6 +243,7 @@ const { page } = Astro.props;
- `pageSize` - The number of items shown per page (`10` by default)
- `params` - Send additional parameters for creating dynamic routes
- `props` - Send additional props to be available on each page
- `format` - **Since v7.1.0.** A function that allows to manipulate the computed URLs before being rendered.

`paginate()` assumes a file name of `[page].astro` or `[...page].astro`. The `page` param becomes the page number in your URL:

Expand Down
Loading