anpigon / obsidian-book-search-plugin

Obsidian plugin that automatically creates notes by searching for books

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Templater Cannot read properties of undefined (reading 'map') when author or category is returned empty

grvn opened this issue · comments

following the instructions in the README.md
the following lines should be used to create lists of authors and categories

authors: <%=book.authors.map(author=>`\n  - ${author}`).join('')%>
categories: <%=book.categories.map(category=>`\n  - ${category}`).join('')%>

But if the search result doesn't contain a catagory, the template fails.

Example:

Create a template containing the two lines
Search for the book "Red Team Development and Operations"

( This book: https://books.google.com/books/about/Red_Team_Development_and_Operations.html?hl=&id=84w_zQEACAAJ )

The plugin fails to detect any category and the teplate fails.