Closed marc-vdm closed 2 years ago
That's a pretty neat idea! Fortunately the handlebars formatting is quite flexible in that regard and the exposed {{entry}}
variable provides us with an Author
array. Those each hold a family
and given
(name) key. (See the docs: http://www.foldl.me/obsidian-citation-plugin/classes/entry.html)
My snippet for comma separated authors in the note template is as follows (minus the line breaks):
Authors:
{{#each entry.author}}
[[{{this.given}} {{this.family}}]]
{{#unless @last}}, {{/unless}}
{{/each}}
I tried and this works, awesome!
Thanks a lot for taking the time to figure this out and share the solution
Came here looking for a way to have only the last names of the authors in my literature note title, a slight modification to @JohnnyGoodNews 's solution does the trick, thanks alot!
{{#each entry.author}}{{this.family}}{{#unless @last}}, {{/unless}} {{/each}}
The
{{authorString}}
enables a template file to include a list of all authors, however, I'd love to connect individual references to their respective authors.It would be amazing if there'd be another variable like
{{formattedAuthorString}}
that would automatically create a formatted list of the authors For example the output of{{authorString}}
could be:Foo Bar, Aaa Bbb
Then the output of{{formattedAuthorString}}
would be:[[Foo Bar]], [[Aaa Bbb]]
.This would enable automatic linking of publications to their authors, which could provide an easier workflow than manually having to edit links for every reference.
I'm unfortunately not familiar with javascript or how obsidian plugins work but in python I guess it'd look something like:
or in a more readable format: