API > GetPage
The GetPageByPath function is used to fetch the content/properties of one page. Fetch the page by the page path.
This function will return a type Page.
import { getPageByPath } from "@suncel/nextjs/api";
const getPageByPath = async (
path: string[],
options?:GetPageOptions
): Promise<RequestResult<Page>>
path: The path of the page to fetch (example: [’blog’, ‘first-article’])
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 )