Support Default Limit to Collections
This tutorial was contributed by Athira and Harshith
This tutorial is for setting the default collection items limit. If there are no storyLimits
passed for a particular collection will fall back to defaultNestedLimit
and if there is no defaultNestedLimit
passed, it will fall back to 40.
Steps to implement
- First ensure that @quintype/framework is at the latest version
- Pass
defaultNestedLimit
key with required default limit togetCollectionBySlug
as shown below.
...
import { getStoryLimits } from "../../isomorphic/components/get-collection-template";
export async function loadHomePageData(client, config, slug) {
const collection = await Collection.getCollectionBySlug(
client,
slug,
{ "item-type": "collection" },
{ depth: 2, storyLimits: getStoryLimits(), defaultNestedLimit: 4 }
);
...
}