Templates - how to create, edit, and insert?

To create or define a template:

  • right-click a block bullet
  • choose Make Template
  • enter a template name and click Submit
    • note: should fix it to allow Enter to also submit the template name
    • note: should add a way to show existing template names, to check for duplicates, and potentially to allow for overwriting existing templates
  • the block and any children will now appear as an option in the list of templates

To rename a template:

  • click and edit the block property template: template_name

To edit an existing template:

  • locate the template and click the parent and/or child blocks to enter editing mode, make any needed changes
  • note that these changes will not propagate to existing instances of template (i.e. places where you previously inserted a copy of the template)

To use a template (i.e. insert a copy of the template):

  • in editing mode, type / and select Template
  • select the template you want to insert and type Enter
6 Likes

What am I doing wrong if after /templates --> Meeting Notes Template = nothing blank?

I can’t follow the question, can you provide more detail about what you are doing, what you expect to happen, and what actually happens?

Maybe you just make an empty template?
Recorded a GIF for this:

2 Likes

That is very useful, thank you will implement this

@Zhiyuan_Chen Thank you for this. I figured the same. I think where I am having trouble is I have forgotten where I put in the contents of the template. Is it between “PROPERTIES” and “END”? Do the contents have to be one the same line as properties?

Contents should not be put between “PROPERTIES” and “END”, and child blocks can also be part of the template.

Text of this page attached here:

---
title: Logseq
---

## some contents
:PROPERTIES:
:template: test2
:END:
### texts
1 Like

how can i delete a template?

Just delete the template block

or removing the template property should work too

To find all templates

{{query (property template) }}
2 Likes

I believe the most convenient way to deal with templates is to create a dedicated file that will hold all the templates in one place (in my case I named it ls_templates.md. that way, I can easily find and edit my source templates.

note that templates can be structured bullets, but also be :PROPERTIES: (with one drawback : the order of properties is not saved) or a mix of both.