Additionally to the slot function, you can embed a view one or multiple times. This views are called partials.

You may use them like this in the .ejs template.

<%= partials('Section', [{'name': 'Easy'}, {'name': 'Difficult'}, {'name': 'Impossible'}]) %>

This will execute the views views/partials/Section.ejs (or .md or whatsever view engine you use!) and set params.name for each of them.

If you want to include only a single element, use the keyword partial and no array for the parameters.

<%= partial('Section', {'name': 'Easy'}) %>

Comments