You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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