Quick Start
Get your DNS service credentials
To create a Nextra Docs site manually, you have to install Next.js, React, Nextra, and Nextra Docs Theme. In your project directory, run the following command to install the dependencies:
bash pnpm i next react react-dom nextra nextra-theme-docs
If you already have Next.js installed in your project, you only need to
install nextra
and nextra-theme-docs
as the add-ons.
Add Next.js Config
Create the following next.config.js
file in your project’s root directory:
const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.jsx",
});
module.exports = withNextra();
// If you have other Next.js configurations, you can pass them as the parameter:
// module.exports = withNextra({ /* other next.js config */ })
With the above configuration, Nextra can handle Markdown files in your Next.js project, with the specified theme. Other Nextra configurations can be found in Guide.
Create Docs Theme Config
Lastly, create the corresponding theme.config.jsx
file in your project’s root directory. This will be used to configure the Nextra Docs theme:
export default {
logo: <span>My Nextra Documentation</span>,
project: {
link: "https://github.com/shuding/nextra",
},
// ...
};
Full theme configurations can be found here.
Ready to Go!
Now, you can create your first MDX page as pages/index.mdx
:
# Welcome to Nextra
Hello, world!
And run the pnpm next
command to start developing the project! 🎉
Hello, world!
Pagination
In this guide, we will look at how to work with paginated responses when querying the Protocol API. By default, all responses limit results to ten. However, you can go as high as 100 by adding a limit
parameter to your requests. If you are using one of the official Protocol API client libraries, you don't need to worry about pagination, as it's all being taken care of behind the scenes.
When an API response returns a list of objects, no matter the amount, pagination is supported. In paginated responses, objects are nested in a data
attribute and have a has_more
attribute that indicates whether you have reached the end of the last page. You can use the starting_after
and ending_before
query parameters to browse pages.