Obsidian Folder Notes

Intro

We'll be creating a UI when we click on our folders, built with automation for better user experience as shown in the featured image above.

Required Plugins

Install the following plugins from the community plugins in the settings:

  • Folder Note
  • Templater
  • Optional: Banners

Folder Note Creation Automation Script

We're all lazy and we don't want to do repeated tasks, therefore I have created a script that will create folder notes with a generated item list, links to the children folders and place holders for folder pictures. This means that whenever you create a new child folder you can remove the parents folder and recreate a folder note by ctrl+click on the folder in the Obsidian navigation sidebar.

Create a file called `folder_note_item_list.js` with the following contents:

function my_function (tp,app) {

    var asset_library_path = "Obsidian Vault/Archive/Assets/"

    var file_path = tp.file.path(true)
    file_path = file_path.split('/')
    file_path.pop()
    file_path = file_path.join('/')

    folder_children = app.vault.fileMap[file_path].children

    var items = []

    for (let i = 0; i < folder_children.length; i++) {
        const element = folder_children[i];
        var last_element_item = element.path.split('/')
        last_element_item = last_element_item[last_element_item.length -1]
        if(element.path.substring(element.path.length - 3) !== ".md"){
            
        
            var array_path_split = element.path.split('/')
            var item_title = array_path_split[array_path_split.length -1]

            var item = [
                "\n    {"+
                "\n        title: '"+item_title+"'",
                "\n        image: '"+item_title+".jpg'",
                "\n        brief: ' '",
                "\n        foot: 'Folder'",
                "\n        link: '"+element.path+"/"+last_element_item+".md'",
                "\n    }"
            ]
            item = item.toString()
            items.push(item)
        }
    }

    var card = [
        "```ccard"+
        "\nitems: ["+  
        "\n"+ items+
        "\n]"+
        "\nimagePrefix: "+asset_library_path+
        "\n```"+
        "\n"
    ]

    card = card.toString()

    return card
}

module.exports = my_function

Edit the line of code below with the path to your asset library within Obsidian.

var asset_library_path = "Obsidian Vault/Archive/Assets/"

Now save this file under your Templater folder in a new folder called "Scripts", if you don't have a templater folder yet create a new folder called "Templater".

Templater Plugin Settings

Go to the Obsidian Settings and find the Templater plugin settings. Find "User Script Functions" and add the path to the "Scripts" folder we just created. You should now see the following in the detected user scripts list:

tp.user.folder_note_item_list

If you just created the "Templater" folder you need to find "Folder Templates" in the Templater plugin settings and add your folder template like this:

Folder Note Plugin Settings

Now go to the Folder Note plugin settings and add the code below to the "Initial Content".

---
aliases: [{{FOLDER_NAME}}]
type: folder-note
banner: "![[{{FOLDER_NAME}}.png]]"
---

<% tp.user.folder_note_navigation(tp) %>

`button-folderup` `button-newnoteinfolder`

# {{FOLDER_NAME}}

<% tp.user.folder_note_item_list(tp,app) %>


# Files

```ccard

type: folder_brief_live
noteOnly: true
```

The only thing you now have to do is add an image to your asset library with the folder name.jpg