Code snippets
A few snippets that provide building blocks for custom formatting functions
Generic snippets
Basic function structure
window.myFuncName = function(item){
let metadata = [];
// Code snippets should be here
return metadata = [];
}Adding an element as block if it exists
if(item.<element_path>{
metadata.push(item.<element_path>);
}
// Example :
// Item title, located under the item's `data` property
if(item.data.title){
metadata.push(item.data.title);
}Attribute-specific snippets
data.creators
data.dateAdded
data.itemType
data.tags
Additional data (collections, PDFs, notes...)
Getting an item's collections
Getting an item's children (PDF + notes)
Basic syntax
Function arguments
What the function returns
How to use the function in your code
Last updated