Due to the language barrier, I probably don’t know how to ask
What I’m trying to do
In the Weekly report, I’m gathering daily notes for my runs. Currently, if I want those notes (img) to be seen as an internal link, as per Obsidian help for Graph view:
The Graph view lets you visualize the relationships between the notes in your vault.
Static internal links will display in the graph view. Dynamic links, as from Dataview will not show in the graph view.
So in order for them to show in the graph view, you need to make them static. This can be done from dataviewjs, og you in addition presenting the links in your table/list, also use app.fileManager.processFrontMatter() to add any link(s) to some “random” property to make them static.
I’ve not done this anywhere, but it should be doable, I think, and if you use a given property you could possibly choose to hide it from the property view using CSS. Hmmm… I might need to play around with this idea the next time I’ve got some extra spare time.
What I’ve not done earlier is pushing links to the frontmatter for the purpose of them showing up in the graph view. I’ve done plenty of frontmatter changes through queries.
(I’m contemplating on whether pushing all links, or having a button to push/toggle specific links would be the better option? )
So, as I understand, I should be able with processFrontMatter() to write some values into the properties keys. Why none of those methods doesn’t write anything into the YAML header?
@holroy, you’re a genius! OK, at least Obsidian genius!!
I will mark your first answer as a solution, as it was the proper solution; the rest was to figure out how to implement it properly. And I did it like this:
// Function to add daily note links to the weekly note's frontMmtter
function addLinksToFrontMatter(file, links) {
setTimeout(() => {
app.fileManager.processFrontMatter(file, fm => {
if (!fm.linkedNotes) {
fm.linkedNotes = [];
}
links.forEach(link => {
if (!fm.linkedNotes.includes(link)) {
fm.linkedNotes.push(link);
}
});
});
}, 200);
}
// Extract links from the daily entries
let dailyLinks = entries.map(p => `[[${p.file.name}]]`);
// Get file as TFile
const file = await app.vault.getFileByPath(dv.current().file.path)
// Add them to the weekly note's frontmatter
addLinksToFrontMatter(file, dailyLinks);