Home Manual Reference Source Test Repository
import FileSystemCollection from 'reptar/lib/collection/type/file-system.js'
public class | source

FileSystemCollection

Extends:

CollectionBase → FileSystemCollection

A collection that derives its content from the location of a file in the file system.

Constructor Summary

Public Constructor
public

constructor(name: *, collectionConfig: *, config: *, renderer: *)

Member Summary

Public Members
public

Array of paths to exclude from including in this collection.

public

Array of file id's that belong in this collection.

public

pages: *[]

Method Summary

Public Methods
public

addFile(file: File): boolean

Add a file to the collection.

public

Create CollectionPage objects for our Collection.

public

populate(files: Object<string, Files>, collections: Object<string, CollectionBase>): Collection

Populate the Collection's files via file system path or metadata attribute.

Inherited Summary

From class CollectionBase
public static

sortFiles(files: Array<File>, sortConfig: Object, dateFormat: string): Array<file>

Sorts files according to a sort config object.

public

Data accesible to templates.

public

Unique ID of this Collection, currently its given name.

public

Metadata attribute to use to find which items are within the collection.

public

The collection name.

public

Size of each CollectionPage.

public

Array of CollectionPage objects.

public

Path where items belong within the collection.

public

Permalink information.

public

Sorting configuration.

public

What template to use when rendering a CollectionPage.

protected
protected
public

createPage(index: number, pageIdArg: string): CollectionPage

Create a CollectionPage instance.

public

Whether a File is filtered by the configured filters.

public

populate(files: Object<string, Files>, collections: Object<string, CollectionBase>): CollectionBase

Populate the Collection's files via file system path or metadata attribute.

public

write(siteData: Object): Promise

Writes every page in this collection.

Public Constructors

public constructor(name: *, collectionConfig: *, config: *, renderer: *) source

Create a Collection instance.

Override:

CollectionBase#constructor

Params:

NameTypeAttributeDescription
name *
collectionConfig *
config *
renderer *

Public Members

public excludePaths: Array<string> source

Array of paths to exclude from including in this collection.

public files: Object<string, File> source

Array of file id's that belong in this collection.

public pages: *[] source

Array of CollectionPage objects.

Override:

CollectionBase#pages

Public Methods

public addFile(file: File): boolean source

Add a file to the collection.

Params:

NameTypeAttributeDescription
file File

File object.

Return:

boolean

True if the file was added to the collection.

public createCollectionPages(): boolean source

Create CollectionPage objects for our Collection.

Return:

boolean

True if we successfully created CollectionPages.

public populate(files: Object<string, Files>, collections: Object<string, CollectionBase>): Collection source

Populate the Collection's files via file system path or metadata attribute.

Override:

CollectionBase#populate

Params:

NameTypeAttributeDescription
files Object<string, Files>

All Files.

collections Object<string, CollectionBase>
  • nullable: true

Object of all collections.

Return:

Collection