# Introduce preset/user definable variables system

**URL:** <https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519>\
**Category:** Feature requests\
**Created:** [May 26, 2020, 9:48am UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519 "2020-05-26T09:48:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valery\_Kondakoff](https://forum.obsidian.md/user_avatar/forum.obsidian.md/valery_kondakoff/32/165_2.png) [@Valery\_Kondakoff](https://forum.obsidian.md/u/Valery_Kondakoff)\
**Post date:** [May 26, 2020, 9:48am UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519/1 "2020-05-26T09:48:04Z")

</div>

I think some kind of preset and/or user definable variables will be a great addition to growing Obsidian possibilities.

_ **Example of preset variables:** _

- `UName` = user account name
- `Date` = current date
- `Time` = current time
- `Title` = current note name
- etc

It will be good to give user a way to define it’s own variables. (Special GUI needed? Or just a quick config-file setup.)

There should be a special syntax to expand variables. Something like this:  
`[%Date%]`

Thoughts? Let’s brainstorm this!

---

<div class="post-metadata">

**Author:** ![BlueSun](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/b/8797f3/32.png) [@BlueSun](https://forum.obsidian.md/u/BlueSun)\
**Post date:** [May 27, 2020, 4:39pm UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519/2 "2020-05-27T16:39:39Z")

</div>

Something like this is probably better suited toward a specialized text expansion program (I use aText, somewhat arbitrarily). This are going to be more fully featured than Obsidian could realistically be without taking time away from developing other features.

I have a few useful shortcuts already set up. Besdies xdate (which would be replaced with 2020-05-27, or xday (Wednesday, May 27, 2020), I also have xz set up to replace with [[(contents of clipboard)]], so I can highlight text, press CMD-x to copy, then press xz to insert it as a link.

---

<div class="post-metadata">

**Author:** ![Valery\_Kondakoff](https://forum.obsidian.md/user_avatar/forum.obsidian.md/valery_kondakoff/32/165_2.png) [@Valery\_Kondakoff](https://forum.obsidian.md/u/Valery_Kondakoff)\
**Post date:** [May 27, 2020, 5:01pm UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519/3 "2020-05-27T17:01:30Z")

</div>

These are mostly mean to be used as a placeholder in newly created notes. Say: `%UName%-diary-%Date%`, or `%Cursor%` - for cursor placement.

---

<div class="post-metadata">

**Author:** ![jozefs](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/j/9fc348/32.png) [@jozefs](https://forum.obsidian.md/u/jozefs)\
**Post date:** [May 28, 2020, 7:48pm UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519/4 "2020-05-28T19:48:46Z")

</div>

I agree, this would be very useful with new note templates. I come from VSNotes which has a similar feature, where variables can be defined in the config and then used in new note templates (both in the file name and in the note content). Examples of variables I use:

- ISO timestamp. This is included in the note header.
- Note title. This is included in the generated note file name and automatically inserted as the title in the note content.

A related feature I use in VSNotes is transforming the variables, specifically lowercasing the title and replacing spaces with underscores in the note title when used in the file name.

---

<div class="post-metadata">

**Author:** ![achamess](https://forum.obsidian.md/user_avatar/forum.obsidian.md/achamess/32/257_2.png) [@achamess](https://forum.obsidian.md/u/achamess)\
**Post date:** [May 31, 2020, 11:20am UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519/5 "2020-05-31T11:20:44Z")

</div>

Agree with this. If we could have variables, some parts of text could autogenerate on the fly. For example, in my notes, I like to have the note title as the first line, with Header 1:

# My Note

It would be nice if this was a variable such as:

#\<note\_title\>

So that it would automatically render properly, even if the note title changes.

---

<div class="post-metadata">

**Author:** ![b3u](https://forum.obsidian.md/user_avatar/forum.obsidian.md/b3u/32/707_2.png) [@b3u](https://forum.obsidian.md/u/b3u)\
**Post date:** [June 4, 2020, 1:52pm UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519/6 "2020-06-04T13:52:42Z")

</div>

I would find this very useful for generating daily notes. If the date is “2020-06-05”, I’d like to generate a title such as “Friday, June 5”.

---

<div class="post-metadata">

**Author:** ![tristanbailey](https://forum.obsidian.md/user_avatar/forum.obsidian.md/tristanbailey/32/4657_2.png) [@tristanbailey](https://forum.obsidian.md/u/tristanbailey)\
**Post date:** [September 27, 2020, 4:33pm UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519/7 "2020-09-27T16:33:09Z")

</div>

A note for future people searching for this. (I would still like a variables system)  
In v8+ there is date feature for Daily Notes re b3u question.

Go to the Daily Notes plugin and change Date Format for new daily to  
“Friday, June 5”  
`dddd, MMMM d`

And in the template if you wanted to repeat that in the markdown template.  
`{{date:dddd, MMMM d}}`

---

<div class="post-metadata">

**Author:** ![JonesInTheSlowLane](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/j/6de8d8/32.png) [@JonesInTheSlowLane](https://forum.obsidian.md/u/JonesInTheSlowLane)\
**Post date:** [October 27, 2020, 8:17am UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519/8 "2020-10-27T08:17:17Z")

</div>

Is there any feature like this now? 🙂

---

<div class="post-metadata">

**Author:** ![Avdberg](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/a/bc79bd/32.png) [@Avdberg](https://forum.obsidian.md/u/Avdberg)\
**Post date:** [January 18, 2021, 11:00am UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519/9 "2021-01-18T11:00:44Z")

</div>

Would also love to know!

---

<div class="post-metadata">

**Author:** ![ktnr](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/k/dfb087/32.png) [@ktnr](https://forum.obsidian.md/u/ktnr)\
**Post date:** [December 7, 2022, 10:23pm UTC](https://forum.obsidian.md/t/introduce-preset-user-definable-variables-system/519/10 "2022-12-07T22:23:38Z")

</div>

Does this do the job? [GitHub - d-brown43/obsidian-macros](https://github.com/d-brown43/obsidian-macros)
