Partials are just normal pages which contain reusable templates you'd like to embed in different pages. There is no difference between pages and partials other than how they're embedded where pages are embedded in a _layout using the {{ page }} expression and partials are embedded using the partial block filter which can also define scoped arguments on the call-site using an Object literal:


Select Partial

Another way that partials can be embedded is using the selectPartial block filter which will re-evaluate the same partial for each item in the collection which is made available in the it binding, e.g:


Resolving Partials and Pages

Just like pages, partials are resolved from the TemplateContext's configured VirtualFiles sources where partials in the root directory can be resolved without any specifying any folders:

{{ 'my-partial' | partial }}
Cascading resolution

If an exact match isn't found it will look for the closest page with that name it can find, starting from the directory where the page that contains the partial is located and traversing up until it reaches the root folder.

Otherwise you can specify the virtual path to the partial from the Virtual Files root, e.g:

{{ 'dir/subdir/my-partial' | partial }}

made with by ServiceStack