Bookshelves

It appears as if the names of the bookshelves cannot validly contain numbers when trying to grab them for a theme. For example, I played around with bookshelves named 2020 and r2021. With r2021,

{{- range $bookshelf_key, $bookshelf := site.Data.bookshelves }}

<h2 class="bookshelf-key">{{ $bookshelf_key }}</h2>

Results in an h2 called just r from r2021. My use case is automating my annual reading list, so I want a bookshelves named something like, “Read in 2021, Read in 2022” and to be able to programmatically move through those bookshelves and get a display name. Is there some other property (like display name) that I can use?

I’ve confirmed that Micro.blog is taking out the numbers. I think I was being a little paranoid with those, and I should be able to update it to preserve the numbers. I’ll get that out in the next day or so.

1 Like

@jsonbecker I’ve fixed this so that numbers in bookshelf names are now preserved.

Thanks! This was a big help. Another small feature request on books – I’d love to be able to edit more meta data when viewing a book. For example, if I find that the edition no longer exists or is sold for a book, I can’t edit the ISBN to a currently available edition right now, just name and author. So I end up having to delete and re-add the book. And because ISBN/edition are not super clear when there are multiple results, I end up searching for a book in a different platform (store), getting the current ISBN, and searching by ISBN (or uploading) to Micro.blog to get the right version.

Even just editing ISBN here would help:

(I’m cleaning up a lot of book data from various sources before letting things go live on my blog)

Thanks, I can’t think of a reason not to allow editing the ISBN too.

Sorry if this is not the best place for feedback, but here’s another thing that came up:

Because the data in .Site.Data.bookshelves has the shelf name as the key inside of the map, I can’t sort it (see this post-- sorting results in key elimination.

I’d like to be able to sort on shelf name, so would it be possible to have the data structure changed a bit so that the shelf name was accessible for each element in the map?

To give you a sense of what I’m working on, I basically want to create this page, ordered and with “formatted” names with Currently Reading on top and each year below. I’ve gotten pretty close with this template:

{{- range $shelf, $bookshelf :=  $.Site.Data.bookshelves  }}

{{ if ne $shelf "finishedreading" }}
  <h2 class="bookshelf-name">{{ $shelf }}</h2>
  <div class="bookshelf">
    {{- range $bookshelf }}
  <a href="https://bookshop.org/a/{{ $.Site.Params.bookshop_affiliate_id }}/{{ .isbn }}">
<figure>
 <img 
      class="bookshelf-book-cover"
      src="{{ .cover_url }}"
      alt="{{ .title }} by {{ .author }}"
      width="150"/>
    <figcaption> {{ .title }} by {{ .author }}</figcaption>
</figure></a>
{{ end }}
</div>
{{ end }}
{{ end }}

and I’m just thinking through how I’m going to format the shelf names and get the order to my liking.

Realizing that one way to handle this could be that instead of changing the data structure, if the option to order bookshelves existed in the interface and that was the order of the data, then I’d have control that way. This would have the advantage of not impacting anyone else who currently relies on this data structure.

Thanks, yeah, the current structure isn’t really well-suited for iterating over the bookshelves. I had imagined that most people would already know what shelves they had. But of course, then it’s harder to build general-purpose plug-ins and whatnot.

I’ll look into ordering.

I may or may not have broken this one. Gonna come back around to it after I finish refactoring some of the others (being able to choose a specific branch or w/e when cloning into Hugo would be a huge help with not breaking things others are using).

When I’m done I’ll have a sh$t ton of plugins and they will all be well documented

I have this covered with my use of data config files … I just haven’t touched the bookshelf plugin practically since I created it. Once I’m done refactoring I will have a consistent paradigm across all my plugins for advanced customization via self-documented TOML templates. plugin cards is the current model with its modular (TwitterOG, StructuredData, and Cardify) components reflected by the structure of the files in data directory. Parameter values are merged hierarchically (theme data file | plugin data file | hardcoded value) and used to dynamically generate any stylesheets or scripts according to parameter values.

The only thing not awesome about that plugin is the README, which I have yet to update.

The major discrepancy is that generating preview cards to appear within blog posts now uses a shortcode exclusively and external pages are now supported. Thanks to @sod, I’m scraping pages statically. The shortcode takes an optional parameter specifying whether the cardified link is intended to cross post. If so, the statically generated preview card is hidden via comment within an ordinary link (so other platforms generate cards) and Javascript unearths the generated fragment and replaces the link.

this is when my hacky approach of deleting the plugin to get an archived page comes in handy! L. Warner (aka Cerulean) Writes - Bookshelf still works!

theme error for Simple which I’m trying out:


plugin on latest update

I know you can associate a bookshelf with only one page and thus cannot have multiple bookshelves show up on a single page. I created two other pages and hid them from the menu but linked to them from the “Currently Reading” page.

However, I want those links to show up after the Currently Reading book list. Any idea how to do that?

I’ve tried twice now and I can’t get my Goodreads info to import to Micro.blog. I have 1,654 books tracked on Goodreads and less than 200 show up on Micro.blog. Any tips/tricks?

Is it possible that most of the books were Kindle or Audible versions? Goodreads does not always include the ISBN for those, and unfortunately Micro.blog has to skip them. This is a bigger problem than I realized at first so I’m looking into solutions, such as finding the closest match by title and author when there is no ISBN.

No, very few would be Kindle versions, and I don’t use Audible. Most of them are physical books.

Would you mind posting your file? I have run into issues as well, and virtually all of them were due to Goodreads having incomplete ISBN and similar data. It’s actually one of my core reasons I’ve moved to as many platforms as possible with this data-- Goodreads is completely unreliable as a portable source of book data, throwing in ASIN numbers instead of ISBN numbers, having weird editions issues etc.

I just downloaded my Goodreads file again and looks like about 40% of the books are missing ISBNs. Mostly Kindle books, but a few print books too. I’m going to try to work around this since there’s very little chance Goodreads will change it.

I’ve improved the Goodreads import to attempt to find other editions of a book if there is no ISBN provided in the CSV file you upload to Micro.blog. It does this by crawling Goodreads metadata because Goodreads no longer offers an API. I’m afraid this solution is a little fragile, but it’s likely to keep working on the short term. In my initial testing, it works really well.

:wave:

I’m new around here and love the bookshelves feature. Wondering if there were any plans to offer a similar function for other forms of media? I would love to track movies, TV shows, video games in the same way as this.

3 Likes