A tiddlywiki.files JSON file in a sub-folder within a TiddlyWiki folder overrides the usual logic for recursively scanning the folder for tiddler files. Instead, the tiddlywiki.files file specifies instructions for loading tiddlers from specific files and folders.
The format of the file is an object with two optional properties:
Note that significant enhancements to tiddlywiki.files processing were introduced in Release 5.1.14.
Both the tiddlers and directories sections of tiddlywiki.files files include the ability to override or customise the values of fields with a fields object.
Each field can be specified as either a string or array value to be assigned directly to the field, or New in: 5.1.14 an object describing how to generate the value for the field. The object contains the following properties:
The file specifications in the tiddlers array support the following properties:
tiddlywiki.files file)true, the file will be treated as a tiddler file and deserialised to extract the tiddlers. Otherwise, the raw content of the file is assigned to the text field without any parsingtext fieldNote that providing a prefix here is equivalent to setting thetextfield of the fields object to{"prefix":"<prefixvalue>"}.
Directory specifications in the directories array may take the following forms:
tiddlywiki.files file). The directory is recursively searched for tiddler filestiddlywiki.files file). Note that the directory is not recursively searched; sub-directories are ignoredtrue, the file will be treated as a tiddler file and deserialised to extract the tiddlers. Otherwise, the raw content of the file is assigned to the text field without any parsingFields can be overridden for particular files by creating a file with the same name plus the suffix .meta – see TiddlerFiles.
These example tiddlywiki.files must be placed in their own sub-directory of the wiki folder.
There are also several examples of tiddlywiki.files files in the main TiddlyWiki 5 GitHub repository.
This example retrieves all the files with the extension .pdf from a folder specified by a relative path. Each tiddler is set up for LazyLoading with the following fields:
application/pdf$:/tags/AttachedFile{
"directories": [
{
"path": "../../../input/pdfs",
"filesRegExp": "^.*\\.pdf$",
"isTiddlerFile": false,
"fields": {
"title": {"source": "basename-uri-decoded"},
"created": {"source": "created"},
"modified": {"source": "modified"},
"type": "application/pdf",
"tags": ["$:/tags/AttachedFile"],
"text": "",
"_canonical_uri": {"source": "filename", "prefix": "pdfs/"}
}
}
]
}