Partials are just normal pages which contain reusable scripts 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 method 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 method which will re-evaluate the same partial for each item in the collection which is made available in the it binding, e.g:


Inline Partials

Partials can also be defined in-line with the {{ #partial }} block statement:

The linq 04 example below shows how to implement this without partials using {{ #each }} statement blocks:

Resolving Partials and Pages

Just like pages, partials are resolved from the ScriptContext'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 }}


Use ownProps to iterate all user-defined arguments specified for a partial, e.g:

made with by ServiceStack