Read directories of markdown and yaml files and output some json. Does not process markdown into html (yet?).
Keys are sorted so files are more git friendly if tracking changes. Try jsonArgs: { spaces: 2 }
in options to make commits cleaner.
Creates a big file with all the content of all the content types.
A file with just the items from that collection or content type.
Creates a json-schema file based on the input.
Future: Creates an openapi file based on the input.
import processContent from "static-content-api";
processContent({
parentDir: 'content',
outputDir: 'public/data',
})
{
customSortVals: {
id: '!', // used to assign a custom relative sort position.
},
// fieldSorter: () => {},
jsonArgs: {
// spaces: 2,
},
// fields: [
// 'base', 'blocks', 'ctime', 'dir', 'ext', 'mtime', 'fileSlug', 'language', 'name', 'pathParts',
// 'parentDir', 'path', 'size', 'sourcePath' ],
keyIndex: true, // Output "Summary File" an array or an object keyed by collection.
// groupBy: 'collection',
ignoreDirs: ['foo', 'ignore', 'config'], // Ignore root directories/collections.
ignoreDotFiles: true,
mergePathProps: true, // Extracted file path properties should be added to top level data. Otherwise within `info.pathProps`.
mergeInfo: false, // Merge in file information or false to leave it inside the `info` property.
outputDir: 'public',
outputFilename: 'index',
parentDir: 'content', // Where to find the collections of content.
pathProps: ['collection'],
requireDir: false, // Do not process files in the root, without being in a collection.
requireExt: true,
}
processDataFile()