-
Notifications
You must be signed in to change notification settings - Fork 131
Partials
Partial templates separate out re-usable and repeatable blocks of code into their own files. They sit within the /templates/partials folder. Partials are similar to the idea of linking to .css or .js files in the head of an html document, but a partial can be any code used with the Stacey templating language.
Partials do not need to be .html files. Stacey should recognize the following formats: .html, .json, .xml, .atom, .rss, .rdf & .txt
###Including a partial To include a partial, use the following code
{% include 'partials/PathToFile' %}
PathToFile can be a path to any file inside a folder structure within /templates/partials. You can have multiple partials with the same name if they are located in different folders.
Partials references can also be nested within other partials. So, an example partial that checks for page assets could include other partials:
this file can be found in /templates/partials/assets/media.html
{% if page.images %}
{% include 'partials/assets/images.html' %}
{% endif %}
{% if page.video %}
{% include 'partials/assets/video.html' %}
{% endif %}