Function: useAuthorArchive()
useAuthorArchive<
T,P>(params,options):usePostsResponse<T>
Defined in: packages/next/src/data/hooks/useAuthorArchive.ts:29
The useAuthorArchive hook. Returns a collection of post entities queried by author
This hook must be used with a catch-all route [...path].js (e.g: pages/author/[...path].js)
Important: Use a catch-all and not an optional catch-all route ([[...path]].js) as the author param in the url is required.
In order to automatically map URL params create a catch-all route named [...path].js.
You can create the catch-all at any level e.g: pages/author/[...path].js, etc.
The pages/author/[...path].js route for instance would yield a URL like this: /author-name/page/2, /author-name/category/category-name/page/3, etc.
The following URL params are supported:
- Category (/author-name/category/category-name)
- Tag (/author-name/tag/tag-name)
- Author (/author/author-name)
- Pagination (/page/2)
- Custom Taxonomy (/author//taxonomy/term-name)
Type Parameters
T
T extends PostEntity = PostEntity
P
P extends PostsArchiveParams = PostsArchiveParams
Parameters
params
Partial<P> = {}
The parameters accepted by the hook
options
FetchHookOptions<FetchResponse<T[]>> = {}
Options for the SWR configuration