Replies: 2 comments
-
Hi, I use the following:
not entirely sure if it achieves the effect you're looking for 😆 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, here is my snippet for authors. I hope this helps. The logic is this:
The output is a correctly formated YAML list: a new line beginning with
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my zt-note.eta template I use the following to list N authors (or editors) on a single line as links to files.
<% if (it.authors && it.authors[0]) { %><% it.authors.forEach(function(author){ %> [[<%= author %>]] <% }) %><% } else if (it.creators && it.creators[0]) { %><%_ it.creators.forEach(function(creator){ %> [[<%= creator %>]] <% }) %> *(editor)*<% } %>
However, I also store the author names in a Property (FKA Frontmatter) titled 'authors'. However, adapting the above code to work with the property (type=list) is proving difficult.
Things I have tried:
<% if (it.authors && it.authors[0]) { %><% it.authors.forEach(function(author){ %> <%= author %> <% }) %><% } else if (it.creators && it.creators[0]) { %><%_ it.creators.forEach(function(creator){ %> <%= creator %> <% }) %> <% } %>
This list all the authors as a single tag
<% if (it.authors && it.authors[0]) { %><% it.authors.forEach(function(author){ %> [<%= author %>] <% }) %><% } else if (it.creators && it.creators[0]) { %><%_ it.creators.forEach(function(creator){ %> [<%= creator %>] <% }) %> <% } %>
This fails with "Failed to render YAML"
<% if (it.authors && it.authors[0]) { %><% it.authors.forEach(function(author){ %> <%= author + '\n' %> <% }) %><% } else if (it.creators && it.creators[0]) { %><%_ it.creators.forEach(function(creator){ %> <%= creator + '\n' %> <% }) %> <% } %>
Also fails with "Failed to render YAML"
Any ideas how I can go about inserting each author as a single entry in a list type Property?
Beta Was this translation helpful? Give feedback.
All reactions