A small plugin to iterate over metalsmith data.
const Metalsmith = require('metalsmith');
const looper = require('metalsmith-looper');
Metalsmith(__dirname)
.metadata({})
.source('./content')
.destination('./docs')
.use(looper(function({ loopContent }) {
// Loop through HTML files
loopContent(function(file, { move }) {
// Move file and associated assets to another subfolder
move('/root/' + file.$name);
});
}));
Loop through every HTML files.
Loop through every HTML files from a specific subfolder of the sources.
Create a new index to reference content file.
Move the current file, and associated assets, to another destination.
Remove the current from the sources to treat.
Throw an error if the current file doesn't have a specific property.
Throw an error if the current file property do not match any the given values.
Throw an error if the current file has the same property value than another file.
Define the type of document, by default, the type of document is the source subfolder.
Link another file according to a property value.
Add the current file to a spacific index under a specific key.
Retrieve a specific index of files.
The relative path of the current file destination path.
The type of the current file.
An array that contains all indexes.
An object containing the current file.