const targetFolder = "Reference/Purviews/PSP Purviews/Pantheon Purviews";const currentFile = dv.current().file.path;// Find all notes in the specified folder and its subfolders// excluding the current note and Master filesconst pages = dv.pages(`"${targetFolder}"`) .where(p => p.file.path !== currentFile && !p.file.name.toLowerCase().includes("master") ) .sort(p => p.file.path);// Group the notes by folderconst groups = pages.groupBy(p => p.file.folder);// Display each folder oncefor (const group of groups) { const folderParts = group.key.split("/"); const folderName = folderParts[folderParts.length - 1] || "Root"; dv.header(2, folderName); for (const page of group.rows) { // Link directly to the original note dv.el("div", dv.fileLink( page.file.path, false, "↗ Open original note" )); // Embed the original note dv.el("div", dv.fileLink( page.file.path, true )); // Space between notes dv.el("div", "", { attr: { style: "height: 40px;" } }); }}