For each file tracked by
Basically all of the functions documented here are available when writing template and content files. However, unlike content files, template files (or one of their dependencies) need to use the page content file as a page dependency.
[contents]Contents
Specifying where to input/inject content
Note: if
Alternatively to
- use
@content{raw} which will input the content file without parsing it with Nift's template language - use
@system{content}(sys-call) which is equivalent to@system(sys-call $[contentpath]) , where$[contentpath] injects the content path, exceptNift also recognises that the content file has been inject. For example if your content files are markdown and you use@system{content}("pandoc") then the content files will be injected after being converted to html using pandoc - use
@script($[contentpath]) (if the content file is a script/program) - use
@script{content}(script-path, params) which is equivalent to@script(script-path, $[contentpath], params) , where$[contentpath] injects the content path as parameter 1, exceptNift also recognises that the content file has been injected - use
@dep($[contentpath])
Optionally injecting head content
To inject a custom head file for each name using a given template you can use for example:
@input($[contentdir]/$[name].head)
If you would like to inject a custom head file for only some names using a given template you can use for example:
@input{if-exists}($[contentdir]/$[name].head)
Inputting/injecting titles
When building a page,
Example template files
A very simple html template file, that specifies both where content and the title are to be inputted, would be:
<!DOCTYPE html> <html> <head> <title>site title - $[title]</title> </head> <body> @content </body> </html>
It can be convenient to break what would typically be found inside the template file up into various content files (or you can think of them as also being template files, which extension you use is up to you). For example you may have
<!DOCTYPE html> <html> <head> @input(template/head.content) </head> <body> @input(template/menu.content) @content @input(template/footer.content) </body> </html>
Note: the