# Made a template to help with using Johnny.Decimal within an Obsidian vault

**URL:** <https://forum.johnnydecimal.com/t/made-a-template-to-help-with-using-johnny-decimal-within-an-obsidian-vault/1679>\
**Category:** JDHQ\
**Created:** [July 26, 2024, 2:12am UTC](https://forum.johnnydecimal.com/t/made-a-template-to-help-with-using-johnny-decimal-within-an-obsidian-vault/1679 "2024-07-26T02:12:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![miscoined](https://forum.johnnydecimal.com/letter_avatar_proxy/v4/letter/m/7ab992/32.png) [@miscoined](https://forum.johnnydecimal.com/u/miscoined)\
**Post date:** [July 26, 2024, 2:12am UTC](https://forum.johnnydecimal.com/t/made-a-template-to-help-with-using-johnny-decimal-within-an-obsidian-vault/1679/1 "2024-07-26T02:12:55Z")

</div>

I use a JD-style folder structure for maintaining an Obsidian Vault. I found making new files cumbersome as I was often needing to make a new folder at the same time.

I ended up using the Templater plugin to create a folder template which is applied to the entire vault, which prompts for a name, creates a folder with that name with the correct index value, and moves the file to that folder.

```auto
<%*
if (tp.file.folder().split(" ")[0].length > 2) return; // only operate on parents

// move file into the correct Johnny Decimal folder
const title = await tp.system.prompt("Name")
if (!title) return;
const folder = tp.file.find_tfile(tp.file.path(true)).parent
const last = folder.children
  .filter(f => !f.basename) // filter to folders only
  .map(f => f.name.split(" ")[0]).sort().last();
const cat = folder.name.split(" ")[0];
const next = last ? String(Number(last.split(".")[1]) + 1).padStart(2, "0") : "01";
await tp.file.rename(title)
await tp.file.move(`${folder.path}/${cat}.${next} ${title}/${title}`)
-%>

```

Now, whenever I create a new file in eg “23 Locations”, it will automatically prompt for a name and create an appropriate folder with that name and move the new note to that folder. This way I can maintain the JD folder structure while still taking advantage of Obsidian wikilinks without excessive aliasing everywhere.

Thought I’d share it here in case anyone else found it useful.

---

<div class="post-metadata">

**Author:** ![johnnydecimal](https://forum.johnnydecimal.com/user_avatar/forum.johnnydecimal.com/johnnydecimal/32/1759_2.png) [@johnnydecimal](https://forum.johnnydecimal.com/u/johnnydecimal)\
**Post date:** [July 26, 2024, 3:18am UTC](https://forum.johnnydecimal.com/t/made-a-template-to-help-with-using-johnny-decimal-within-an-obsidian-vault/1679/2 "2024-07-26T03:18:31Z")

</div>

Nice! I’ll add this to [31.01 Built for the system • Johnny.Decimal](https://jdcm.al/31.01/)

---

<div class="post-metadata">

**Author:** ![z.mars](https://forum.johnnydecimal.com/user_avatar/forum.johnnydecimal.com/z.mars/32/498_2.png) [@z.mars](https://forum.johnnydecimal.com/u/z.mars)\
**Post date:** [July 26, 2024, 11:25pm UTC](https://forum.johnnydecimal.com/t/made-a-template-to-help-with-using-johnny-decimal-within-an-obsidian-vault/1679/3 "2024-07-26T23:25:08Z")

</div>

Oh, man. This makes me want to go back to Obsidian… Really great work!
