API > GetPage
The GetPage function is used to fetch the content/properties of one page.
Fetch the page by its Id. This function will return a type Page.
import { getPage } from "@suncel/nextjs/api";
const getPage = async (
pageId:string
options?:GetPageOptions
): Promise<RequestResult<Page>>
pageId: Id of the page to fetch
options: Optional fetching options (see below)
type GetPageOptions = {
author?: boolean;
language?: string;
fields?: (keyof Page)[];
excluded_fields?: (keyof Page)[];
};
author: If you want to populate the author information in the result, otherwise you will just received the author id.
language: To filter per language
fields: Specify which fields to return (used to optimise to size of the request)
excluded_fields: Specify which fields to exclude (used to optimise to size of the request) (example: excluded_fields:['content', 'saved-content']
,it will remove the content and the historic from the request. it will optimise the result of the query as those 2 fields can be quite large )