<%* const dv = await this.app.plugins.plugins["dataview"].api; const api = this.app.commands;

const folder = "Bahumbug"; const pages = dv.pages("${folder}"); //const pages = dv.pages("${folder}").where(p ≥ !p.share_link); // if you want to target only notes that haven't already been shared

// Delay function to ensure the commands complete const delay = ms ≥ new Promise(resolve ≥ setTimeout(resolve, ms));

// Iterate through all the notes for (let page of pages) { const notePath = page.file.path;

// Open the note
await this.app.workspace.openLinkText(notePath, "");

await delay(500);

// Share the note (this will update the note's contents if it was previously shared)
api.executeCommandById('share-note:share-note');
await delay(500);

// Close the note
const leaf = this.app.workspace.activeLeaf;
leaf.detach();
await delay(500);

} %>

Built with LogoFlowershow