Contentstack

View as Markdown

Contentstack

The Contentstack module creates an instance of the Contentstack class, which serves as the entry point for initializing a stack.

Stack

A stack is a repository or a container that holds all the entries/assets of your site. It allows multiple users to create, edit, approve, and publish their content within a single space.

The Stack instance provides access to all query methods for fetching entries, assets, and content type data from the local filesystem.

NameTypeDescription
baseDirstring

Base directory of the folder where data is stored

localestring

Default locale to use when .language() is not specified in a query

referenceDepthnumber

The default nested reference field depth considered when calling .includeReferences(). This can be overridden by passing a numerical argument to .includeReferences(n)

projectionsobject

Keys that by default would be removed from results. Pass key: 0 to remove, key: 1 to override the existing

Example:

import { Contentstack } from "@contentstack/datasync-filesystem-sdk";
const config = {
  contentStore: {
    baseDir: './_contents',
    defaultSortingField: 'updated_at',
    locale: 'en-us',
    projections: {
      _content_type_uid: 0,
    },
    referenceDepth: 2,
  },
}

const Stack = Contentstack.Stack(config);