-
Create a "Templates" folder in the Multi-Channel Content Gadget. Note the ID.
-
Create a "Templates" folder in the Media tree. Note the ID.
-
Create a folder on the file system for the Liquid templates. Note the path.
-
The code in
Startup.cs.txt
should be added to yourStartup.cs
file. Change the IDs and paths as necessary. -
Adjust the values in the constructors passed to
MultiSourceTemplateProvider
(or, delete ones you don't want to use) -
Change the
ClientEditor
inTemplateBlock.cs
to match the path ofpoor-mans-code-editor.js
(wherever you end up putting it) -
Compile
The folder paths under the two Templates
folders should match where the temlpates would be on the file system. For example: Templates/Shared/Blocks/MyBlock.liquid
. The "filename" should be the name of whatever content object is acting as the template (block or media asset).
To implement your own template source provider, create that a class that implements ITemplateSourceProvider
.
Implement string GetSource(string path)
.
The path
is the path to the view the engine wants. This will be something like Shared/Blocks/MyBlock.liquid
.
Perform literally any logic you like in here, and return either (1) a string representing the Liquid code, (2) null
to indicate you can't provide a template, in which case the MultiSourceTemplateProvider
will move to the next provider.
The MVC implementation of Fluid has a template caching architecture built-in.
TemplateCacheManager.Clear()
will invalidate the entire template cache.
It has an event capturing implementation that will call Clear
on PublishingContent
and MovedContent
events that involve a TemplateBlock
or TemplateFile