Table of Contents

Previous: Using capture, Up: Capture


Capture templates

You can use templates to generate different types of capture notes, and to store them in different places. For example, if you would like to store new tasks under a heading ‘Tasks’ in file TODO.org, and journal entries in a date tree in journal.org you could use:

     (setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
             "* TODO %?\n  %i\n  %a")
        ("j" "Journal" entry (file+datetree "~/org/journal.org")
             "* %?\nEntered on %U\n  %i\n  %a")))

In these entries, the first string is the key to reach the template, the second is a short description. Then follows the type of the entry and a definition of the target location for storing the note. Finally, the template itself, a string with %-escapes to fill in information based on time and context.

When you call M-x org-capture, Org will prompt for a key to select the template (if you have more than one template) and then prepare the buffer like

     * TODO
       [[file:link to where you were when initiating capture]]

During expansion of the template, special %-escapes1 allow dynamic insertion of content. Here is a small selection of the possibilities, consult the manual for more.

     %a          annotation, normally the link created with org-store-link
     %i          initial content, the region when capture is called with C-u.
     %t          timestamp, date only
     %T          timestamp with date and time
     %u, %U      like the above, but inactive timestamps

Footnotes

[1] If you need one of these sequences literally, escape the % with a backslash.