<%*
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!
// You might have to set the outer quotes of the query as backticks if you are using single quotes in the dataview query (see My Weekly Goals as an example)
const fileAndQuery = new Map([
[
"My recently edited files",
'TABLE WITHOUT ID file.link AS Note, Status, file.tags as Tags, dateformat(file.mtime, "ff") AS Modified FROM "" AND !"My Calendar" AND !"Hidden" SORT file.mtime desc LIMIT 25',
],
[
"My recently created files",
'TABLE WITHOUT ID file.link AS Note, Status, file.tags as Tags, dateformat(file.ctime, "DD") AS Added FROM "" AND !"My Calendar" AND !"Hidden" SORT file.ctime desc LIMIT 25',
],
[
"My Obsidian Publish Queries",
'TABLE WITHOUT ID file.link as Query FROM #publishQuery AND "Hidden/My Obsidian Publish Queries" SORT file.name asc',
],
[
"My Favorite Inputs",
'TABLE WITHOUT ID file.link as Input, Rating, Created FROM #input AND !"Hidden" WHERE rating > 8 SORT rating desc LIMIT 25',
],
[
"My Favorite Series",
'TABLE WITHOUT ID file.link as Series, Rating, Created FROM #inputCollection AND !"Hidden" WHERE rating > 8 SORT rating desc LIMIT 25',
],
[
"My Maps of Content (By Amount of Links)",
'TABLE length(file.outlinks) + length(file.inlinks) as "Total Links", length(file.outlinks) as Outgoing, length(file.inlinks) as Backlinks FROM #moc️ AND !"Hidden" SORT length(file.outlinks) + length(file.inlinks) desc LIMIT 50',
],
[
"Notes (By Amount of Links)",
'TABLE length(file.outlinks) + length(file.inlinks) as "Total Links", length(file.outlinks) as Outgoing, length(file.inlinks) as Backlinks FROM !"Hidden" AND !"My Private Notes" AND !"My Calendar" SORT length(file.outlinks) + length(file.inlinks) desc LIMIT 50',
],
[
"Conceptual Notes (By Amount of Links)",
'TABLE length(file.outlinks) + length(file.inlinks) as "Total Links", length(file.outlinks) as Outgoing, length(file.inlinks) as Backlinks FROM !"Hidden" AND !"My Calendar" AND !"000 Digital Garden" AND !#usv AND !#view/note WHERE !file.frontmatter.tags OR contains(file.frontmatter.tags, "note") SORT length(file.outlinks) + length(file.inlinks) desc LIMIT 50'
],
[
"My Inputs (By Amount of Links)",
'TABLE length(file.outlinks) + length(file.inlinks) as "Total Links", length(file.outlinks) as Outgoing, length(file.inlinks) as Backlinks FROM #input AND !"Hidden" SORT length(file.outlinks) + length(file.inlinks) desc',
],
[
"My Active Goals",
'TABLE WITHOUT ID file.link as Goal, Description, Why, Area FROM #goal AND !"Hidden" WHERE contains(file.frontmatter.Status, "🟨") SORT file.name asc',
],
[
"My Active Projects",
'TABLE WITHOUT ID file.link as Project, list("🎯 " + Description, "💡 " + Why) as "Details", Goal, Area FROM #project AND !"Hidden" WHERE contains(file.frontmatter.Status, "🟨") SORT file.name asc',
],
[
"My Active Outputs",
'TABLE WITHOUT ID file.link as Output, tags, Description FROM #output AND !"Hidden" WHERE contains(file.frontmatter.Status, "🟨") SORT file.name asc',
],
[
"My Published YouTube Videos",
- 'TABLE WITHOUT ID file.link as Video, Published, Created, Description FROM #output/video AND !"Hidden" WHERE contains(file.frontmatter.Status, "🟩") SORT Published, file.ctime desc',
],
[
"My Published Writings",
'TABLE WITHOUT ID file.link as Writing, Created, Description FROM #output/writings AND !"Hidden" SORT file.ctime desc',
],
[
"My Active Inputs",
'TABLE WITHOUT ID file.link as Input, Created, Source FROM #input AND !"Hidden" WHERE contains(file.frontmatter.Status, "🟨") OR contains(file.frontmatter.Status, "🟧") SORT file.ctime desc',
],
[
"My Processed Inputs With 1+ Link",
'table file.ctime as "Created", length(file.outlinks) + length(file.inlinks) as "Total Links", source, rating FROM #input AND !"Hidden" WHERE (contains(file.frontmatter.Status, "🟩") OR contains(file.tags, "🟩")) AND length(file.outlinks) + length(file.inlinks) > 1 SORT file.ctime desc',
],
[
"My Seedling Ideas",
'table file.ctime as "Created" FROM !"Hidden" WHERE contains(file.tags, "🌱") OR contains(file.frontmatter.Status, "🌱") sort file.ctime desc',
],
[
"My Input Collections (By Created Date)",
'TABLE Status, tags, Links from #inputCollection AND !"Hidden" sort file.ctime desc',
],
[
'My Yearly Goals',
'table list("🎯 " + Description, "💡 " + Why) as "Details" FROM #goal AND !"Hidden" WHERE file.frontmatter.Timeframe = dateformat(date(now), "[[yyyy]]") SORT Order, file.name desc'
],
[
'My Quarterly Goals',
'table list("🎯 " + Description, "💡 " + Why) as "Details" FROM #goal AND !"Hidden" WHERE contains(file.frontmatter.Timeframe, dateformat(date(now), "yyyy-Qq")) SORT Order, file.name desc'
],
[
'My Monthly Goals',
`table list("🎯 " + Description, "💡 " + Why) as "Details" FROM #goal AND !"Hidden" WHERE contains(file.frontmatter.Timeframe, dateformat(date(now), "yyyy-'M'MM"))SORT Order, file.name desc`
],
[
"My USV Philosophy Notes",
'table Description FROM #usv/philosophy AND !"Hidden" SORT file.name',
],
[
"My USV Note Types",
'table Description FROM #usv/note AND !"Hidden" SORT file.name',
],
[
"My USV Workflow Notes",
'table Description FROM #usv/workflow AND !"Hidden" SORT file.name',
],
[
"My Books (By Created Date)",
'table Status, Created FROM #input/books AND !"Hidden" SORT Created desc',
],
[
"My Book Applications (By Created Date)",
'table Status, Created FROM #output/bookapplications AND !"Hidden" SORT Created desc',
]
]);
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 = `---\ntags: [publishQuery]\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();
%>