obsidian logo

I recently started using Obsidian for note taking & the plugin community is really amazing.

One useful community plugin is Book Search.

Obsidian Book Search Plugin

While creating templates I noticed this plugin returns small thumbnail images over http.
I added some javascript to fix these problems.

Google Books API #

The plugin returns images using thumbnail size.

  createBookItem(item: VolumeInfo): Book {
    const book: Book = {
      ...
      coverUrl: item.imageLinks?.thumbnail ?? '',
      coverSmallUrl: item.imageLinks?.smallThumbnail ?? '',
      ...
    };
    return book;
  }

src/apis/google_books_api.ts · anpigon/obsidian-book-search-plugin · GitHub

Google Books API Documentation #

volumeInfo.imageLinks.thumbnail (string) Image link for thumbnail size (width of ~128 pixels)

Volume | Google Books API

Book Search Tweaks #

Requirements #

I have a template for book notes using the templater community plugin.
This plugin allows use of javascript when creating new notes with templates.

Obsidian Templater Plugin

Book Template #

Here is the relevant code from the template for images.

---
cover: {{coverUrl}}
---
![cover|250](<% tp.frontmatter["cover"].replace('\&zoom=1', '').replace('http:\/', 'https:\/').replace('\&edge=curl', '') %>)

With this code, new book notes should have the larger image in the body.