Hello, I am using the commercial version of ABP.io and I have a question regarding the Text Template module. As far as I understand, text templates need to be defined within the project and ABP provides a page for managing text templates (url is text-template-management/text-templates). My question is: Is there a way to create a new text template directly from that the page? If creation is supported, could you please explain the recommended approach or how can insert a new template in Abp text template page?
Thx
2 Answer(s)
-
0
- Solution
The Text Template Management UI (
text-template-management/text-templates) does not create new template definitions.
It only lets you edit / localize the contents of templates that are already defined in your application.To have a template show up on that page, you must first define it in code using a
TemplateDefinitionProvider.
After that, the template will appear in the UI and you can manage its content there (per tenant, per culture, etc.).
Step‑by‑step: define a new template that appears in the UI
- Create a template definition provider in your domain (or application) layer:
using Volo.Abp.TextTemplating; public class MyTemplateDefinitionProvider : TemplateDefinitionProvider { public override void Define(ITemplateDefinitionContext context) { context.Add( new TemplateDefinition( "MyApp.MyCustomEmail", // Template name (key) displayName: "My Custom Email", // What you see on the UI layout: StandardEmailTemplates.Message // Optional: use standard email layout ) .WithDefaultCulture("en") // Optional ); } }Ensure the assembly that contains
MyTemplateDefinitionProvideris loaded by an ABP module (normally it is if it’s in your main project).Run the app and navigate to
/text-template-management/text-templates.
You should now see “My Custom Email” in the list. From there you can:- Edit the template content (HTML/text),
- Localize it per language,
- Override it per tenant.
Summary
- No: You cannot create a brand‑new text template definition purely from the Text Template Management page.
- Yes: You can create the definition in code (once), and then maintain its content entirely from the UI afterwards.
- Sources
- Text Template Management module docs
https://abp.io/docs/latest/modules/text-template-management - Community article showing definition in code + UI usage under “Text Template Management” section
https://abp.io/community/articles/jkeb8zzh
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
hi
: Is there a way to create a new text template directly from that the page?
How do you plan to use this new text template?
I mean, the new name is unknown/dynamic. Where do you use it?
Thanks.