<%* const dv = app.plugins.plugins[“dataview”].api; const openPublishPanel = app.commands.commands[“publish:view-changes”].callback;

// Add as many filenames and queries as you’d like! const fileAndQuery = new Map([ [ “Recently Added Blog”, ‘LIST rows.file.name FROM Blog and “Blog” WHERE date >= date(“2024.12.18”) SORT file.ctime ASC’, ], ]);

await fileAndQuery.forEach(async (query, filename) { if (!tp.file.find_tfile(filename)) { await tp.file.create_new("", filename); new Notice(Created ${filename}.); } const tFile = tp.file.find_tfile(filename); const queryOutput = await dv.queryMarkdown(query); const fileContent = ---\npublish: true\n---\n \n\n${queryOutput.value}; try { await app.vault.modify(tFile, fileContent); new Notice(Updated ${tFile.basename}.); } catch (error) { new Notice(“⚠️ ERROR updating! Check console. Skipped file: ” + filename , 0); } }); openPublishPanel(); %>