obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

being able to select folders to ignore/exclude in DV settings, so they don't get indexed

Open xor50 opened this issue 6 months ago • 1 comments

Is your feature request related to a problem? Please describe. Yes, this one. I use Logstravaganza to save the console logging in a file to check them after Obsidian crashes again and the plugin doesn't allow to save logs outside the vault (already opened a request for that there). My logs get spammed with this: Image

Describe the solution you'd like Just the ability to exclude/ignore certain vault paths like many other plugins have. Could solve this specific issue but could generally be useful for people who keep weird things in their vault or have folders that they never want to use dataview on.

Describe alternatives you've considered As mentioned for this specific issue I opened an issue with Logstravaganza that you can check out here: https://github.com/czottmann/obsidian-logstravaganza/issues/17

xor50 avatar Jun 14 '25 18:06 xor50

https://github.com/blacksmithgu/obsidian-dataview/discussions/2619

A temporary patch to exclude certain folders from being indexed by dataview:

Open your .obsidian/plugins/dataview/main.js. Search for async _initialize(files).

Add the following line(s) at the top of that async function:

files = files.filter(file => !file.path.startsWith('excluded_folder1/'));

You can repeat this line many times for each of the subfolder to exclude.

    /** Internal asynchronous initializer. */
    async _initialize(files) {
        files = files.filter(file => !file.path.startsWith('excluded_folder1/'));
        files = files.filter(file => !file.path.startsWith('excluded_folder2/'));
        files = files.filter(file => !file.path.startsWith('excluded_folder3/'));
        
        let reloadStart = Date.now();
        let promises = files.map(l => this.reload(l));
        let results = await Promise.all(promises);

You need to re-apply the patch everytime the plugin is updated.

micmejia avatar Aug 09 '25 00:08 micmejia