docs/en/framework/infrastructure/text-templating/index.md
//[doc-seo]
{
"Description": "Discover ABP's powerful text templating system for dynamic content rendering, supporting conditionals, loops, and localization for enhanced applications."
}
ABP provides a simple, yet efficient text template system. Text templating is used to dynamically render contents based on a template and a model (a data object):
Template + Model =renderer=> Rendered Content
It is very similar to an ASP.NET Core Razor View (or Page):
RAZOR VIEW (or PAGE) + MODEL ==render==> HTML CONTENT
You can use the rendered output for any purpose, like sending emails or preparing some reports.
Template rendering engine is very powerful;
ABP provides two templating engines;
You can use different template engines in the same application, or even create a new custom template engine.
A template can select its rendering engine explicitly with WithScribanEngine, WithRazorEngine or WithRenderEngine. If it does not, the renderer uses AbpTextTemplatingOptions.DefaultRenderingEngine.
The Scriban module selects Scriban as the default engine. The Razor module selects Razor only if no default has already been configured. You can explicitly select the application-wide default:
Configure<AbpTextTemplatingOptions>(options =>
{
options.DefaultRenderingEngine = ScribanTemplateRenderingEngine.EngineName;
});
An engine selected on a template definition takes precedence over this global default.
Get the source code of the sample application developed and referred through this document.