How to create 'living notes'? eg have orphan links automatically populated with entries where I mention/link the term?

###Background, general organization scheme:
I’m using Obsidian (v1.8.10) to write point form notes for the introduction sections of my thesis. I’m hoping I can then transfer this to a word file and then combine my points into properly structured paragraphs. The intro has several sections(S1), each with several subsections (S1.1) and some of those have their own subsections as well (S1.1.1). I have folders for S1 and subfolders for S1.1. Within each S1.1 subfolder, I have notes for each S.1.1.1 subsection, and in those note files, I have more subsections (s.1.1.1.1) separated by headings/subheadings.

What I’m trying to do

  1. I noticed that when I link a new term (using []) (say in S1.1.1.1 it doesnt create a note for that link unless I click it afterwards. eg it appears as an orphan link. Is it possible to automatically create a new note for that file and fill it with the bullet point/lines where I link that term? eg I have a link for vitamin b6 without actually having a note for it. Its a central node in the graph. When I click that node it generates a new note for vitamin B6 but its blank. I want to have it automatically populated with all the entries found in notes linked to the vitabin B6 node (specifically the sentences in which vitamin b6 are linked).

  2. Also, what are the best way to add citations from Zotero? Is it possible to create a link such that it opens up my zotero file when I hit it in obsidian?

Things I have tried

  1. Couldnt find much in help forums

  2. I’ve been using the citations plugin (Jon Gauthier) and use it to keep track of the papers assoc with entries within a note file. However, once its inserted, I can’t do anything with it, its just text.

thanks!

Yes, this is possible with the Note Auto Creator plugin, and also my Atomic Extractor script (shared below). See this for the details of how to apply a template when the note is created using the aforementioned plugin.

Be warned though, this plugin’s syntax for creating notes+links can conflict with the syntax used to insert citations (your other question). As such, the Atomic extractor script might be a better bet.

As mentioned, I have a script called “Atomic extractor” that can format the current selection as a wikilink, let me choose where to create a new note on the selected term (some predefined folders like the “Inbox”, the current folder or any other folder), and also which template to apply to the new note.

For example, the concept template, the argument template, the counter-argument template, the comparison template (compare two notions or concepts) and the overview template.

Using Atomic extractor, you can insert a Dataview query (the overview template I use, which is shared below, is just that - an advanced Dataview query) or an embedded search query by choosing the appropriate template to apply. Details below, favoring using embedded search queries, as these have all text in the vault indexed, in contrast to Dataview.

The full Atomic Extractor script

This template / script requires the Templater plugin to work. The steps needed to configure it properly are indicated with (do this) comments.

The script has a special behavior if you choose the bridge note / comparison note. In that case, if prompts you to select one of the existing notes tagged #concept that you want to compare the selected term with in the new note. The filename will follow the format “Similarities and differences between [Selected text] and [Chosen concept note]”.

<%*
let selection = tp.file.selection();

const dv = this.app.plugins.plugins["dataview"].api;
// (do this) put your note template path here
const templates = dv.pages('"07 - Bins/Templates/Note templates"');
const sortedTemplates = templates 
    .file 
    .sort( f => f.name )

// (do this) put your top folders here, but leave "Other folder" and "Current folder"
const folders = [
	"01 - Inbox",
	"03 - Source notes/People",
	"Current folder",
	"Other folder",
];

const startsWithWhitespace = /^\s*/;
const endsWithWhitespace = /\s*$/;

const startSpaceCount = (selection.match(startsWithWhitespace)[0]).length;
const endSpaceCount = (selection.match(endsWithWhitespace)[0]).length;

if ((startSpaceCount || endSpaceCount) > 0) {
	selection = selection.trim();
}
let title = selection;

let pickedFolder = await tp.system.suggester(folders, folders, true, "Where should the note be created?");

if (pickedFolder === "Other folder") {
	const allFolders = await app.vault.getAllLoadedFiles().filter(x => x instanceof tp.obsidian.TFolder);
	const folderPick = await (tp.system.suggester(item => item.path, allFolders, true, "Where should the note be created?"));
	pickedFolder = folderPick.path;
} else if (pickedFolder === "Current folder") {
	pickedFolder = tp.file.folder(true);
}

const template = await tp.system.suggester((t) => t.name, sortedTemplates);
const template_tfile = await tp.file.find_tfile(template.path);
	
if (template.name === "bridge-note-template") {
	const conceptResults = await dv.pages("#concept");
	const conceptValues = conceptResults.values;
	// console.log("Concept values", conceptValues);
	const secondConcept = await (tp.system.suggester(concept => concept.file.name, conceptValues, true, `Which concept do you want to compare ${title} with?`));
	title = `Similarities and differences between ${title} and ${secondConcept.file.name}`;
	const replaceSelection = await (tp.system.suggester(["Yes", "No"],["replace","keep"], true, "Do you want to replace text with comparison?"));
	if (replaceSelection === "replace") {
		titleLink = (startSpaceCount > 0 ? " ".repeat(startSpaceCount) : "") + `[[${title}]]` + (endSpaceCount > 0 ? " ".repeat(endSpaceCount) : "");
		tR = titleLink;
	} else {
		selection = (startSpaceCount > 0 ? " ".repeat(startSpaceCount) : "") + selection + (endSpaceCount > 0 ? " ".repeat(endSpaceCount) : "");
		tR = selection;	
	}
} else {
	selectionLink = (startSpaceCount > 0 ? " ".repeat(startSpaceCount) : "") + `[[${selection}]]` + (endSpaceCount > 0 ? " ".repeat(endSpaceCount) : "");
	tR = selectionLink;
}
-%>
<%-*
tp.hooks.on_all_templates_executed(async () => {
	await tp.file.create_new(template_tfile, title, true, await app.vault.getAbstractFileByPath(pickedFolder));
}); 
%>

Dataview

Since Dataview doesn’t index all note text, only stuff like lists, tasks etc., it’s hard to recommend an automated approach based on it given this limitation. However, in my case, my literature note template formats the annotations as bullets, which are indexed by Dataview. This opens some interesting doors.

For example, I can select a term, then create a note with a Dataview query that list all the annotations I’ve made featuring this term, grouped by source. But again, it’s limited to creating an overview of the bullets in which the terms has been mentioned, not all text.

The Dataview overview note template

The template requires the Templater plugin to work. It’s set up to suggest two search scopes for Dataview, either the literature / source note folder or the whole vault.

<%-*
const path = await tp.system.suggester(["Literature notes", "Everything"],[`"03 - Source notes/Zotero"`, `""`], true, "Where do you want to pull from?");
const searchTerm = tp.file.title;
-%>

> [!example]+ <% searchTerm %>
> ```dataview
> TABLE without ID Link as "Article",  rows.L.text AS "Text"
> from <% path %>
> flatten file.lists as L
> FLATTEN link(file.link, truncate(file.aliases, 60)) as Link
> where contains(L.text, "<% searchTerm %>")
> GROUP BY Link
> ```

Another similar option is the Feeds plugin, but since it’s also based on Dataview, it has the same limitation of only indexing content in lists. You could create a template with the required codeblock inserted, then create the notes you extract using that template:

```feed
```

A built-in option

Luckily, there is also something built-in that comes closer to what you’re after, and that’s the backlinks panel and embedded search queries. Specifically when you toggle “Show backlinks at the bottom of notes” on in the Backlinks core plugin settings. There, you can see all the linked and unlinked mentions.

If you need something more advanced than the backlinks panel, use embedded search queries, which can search all text in your vault. Such queries could be automatically added as content to your newly created notes using Templater folder templates, or the template picker provided by the Atomic extractor script.

To further enhance the experience of using the backlinks panel and the embedded search queries, you can install the Better Search Views plugin and/or the Backlink Settings plugin.


I think the best way is to use the citekey suggester from the Pandoc Reference List plugin. It appears in the editor as a dropdown suggester when you type @, allowing you to search for items - either based on a bibliography file exported from Zotero or an API connection to Zotero. I find that the former is much faster.

But inserting citekeys is mostly relevant when you plan to convert your markdown document to other formats using Pandoc.

Regardless, the good news is that the Pandoc Reference List plugin renders the citekeys as fully formatted citations, and these rendered citations also get exported with the built-in PDF export. So it’s useful, even if you use the default PDF export. But I think in your case, you’ll definitely want to use Pandoc to convert to docx.

You can copy-paste the formatted bibliography of all your cited sources from the Pandoc Reference List sidebar, or let Pandoc generate that automatically when you export. Again, I recommend the latter so that you can continue to work on the citations in word, if need be. To get live-citations in Word after converting from markdown to docx with Pandoc, use this guide to set up the workflow. It requires a special filter.

The Zotlit plugin’s autosuggester is also good for inserting citekeys, but it’s syntax for triggering the suggester is a bit more bothersome (you have to type [@).

The methods above only work on desktop devices. If you want to do academic work on a tablet, you can use this method to insert citations.


Yes, you can easily template those into your source note template, if you create source notes on your items using Zotero Integration. Or, you can use the Actions and Tags addon for Zotero and this script to copy links to items from Zotero, and then paste them into Obsidian.

Using Zotero Integration, you need this code to select the appropriate item in Zotero:

[**Open in Zotero**]({{desktopURI}})

If you need to link directly to the first attachment and open it in Zotero, you need:
{{firstAttachmentZoteroLink}}

If you need to link back to a specific annotation, you need something like this basic example:

{% for annotation in annotations %}
    {{annotation.annotatedText}} [p. {{annotation.pageLabel}}]({{annotation.desktopURI}})
{% endfor %}

See this forum thread showcasing many great templates: Zotero Integration – Import Templates?