How to automatically add tags via capture template in org mode?

Viewed 292

I was trying to add a specific tag by default to my capture template. So that when the capture is complete, it looks like the following

  * TODO                                  :customtag:

This was the closest thread I was able to find. I was trying to figure out if there is a simpler way to do this, using just template expansions.

1 Answers

The best way to go about this is to use the function org-set-tags The following capture template solves the above question

(org-capture-templates
   '(("p" "Personal" entry
      (file "xyzz/location")
      "* TODO [Personal] %? %(org-set-tags \"personal\")
DEADLINE: %^t")))

Using %() around org-set-tags will ensure that the function is evaluated. You can replace "personal" with any tag of your choice.

Related