Sunday, July 17, 2016

Library Genie: My New Book Randomizer

This morning I spent two hours building something REALLY cool: it is a randomizer for my Freebookapalooza library of free books. You can see it in action here: not bad for two hours of my time, eh?

Try it! For each book you'll see links to online sources, an image, plus the table of contents below the image.

You can see books from the Library at random, looking either at the whole Library or the different subsections, which relate to the subsections of the Myth-Folklore class that I teach.

I also created a modified randomizer just for the India books that I can use in my Indian Epics class: India.

So far, it looks like everything is working really well. If you notice something that doesn't look right, please let me know! I'm kind of suspicious that this all went so quickly and smoothly this morning... but I'm not complaining, ha ha. Even though this is the most complex randomizer I've ever built, it fell into place without a hitch. Easy peasy!

Why is this important?

This is really important to have because just giving students a list of books is not going to help them in exploring adventurously... and I really want my students to explore adventurously. This way they can browse through hundreds of books in a way that is both fun (random! you never know what's coming) and also useful because each blog post conveys way more information than just the title of the book.

You'll notice that some books have an active table of contents where each story title links out to the story online at one of the available sites for the book, while others just have lists of titles. I'd like to go back and make more of those active tables of content: having instant access to a specific story is powerful! For now, though, I am focused on adding new books. Then, I can go back and improve each entry, working on the ones most likely to be of interest to my students.

Here are the tools I used to create this project: This is where I create my content. I really like Blogger, and the nifty ?m=1 mobile view is what allowed me to display the individual book records separate from the rest of the blog layout. This is the genius tool built by Randy Hoyt which takes a simple HTML table and turns it into a javascript, either random or date-based.

Google Sheets: This is where I have a simple three-column table that lists each blog post with the short title, URL, and category tag. This is where I created a new subdomain (Library) to hold the HTML pages that run the randomizer. Each section of the library has two pages: an html page that frames the random book display, and then a script page that displays the random book, plus a javascript file called by that page.

So, there are a total of 33 pages needed to run the project: 22 html files plus 11 javascript files.

Yes, I wrote the HTML files by hand ... because I am a dork: I don't know how to write a real computer program (see below). But now that the HTML files are in place, I don't have to change any of them; to update the system, I just need to update the javascript file. Everything else stays the same!

Update procedure:

Updating a javascript is really easy; it literally takes just a few minutes:

1. Open spreadsheet
2. Sort by category.
3. Highlight the part of the URL column for the category I am updating.
4. Copy the URLs into a text file.
5. Do a find-and-replace to add in the table-making HTML code in-between each URL.
6. Save the resulting file.
7. Upload file and convert to javascript using
8. Save javascript file.
9. Upload javascript file to

To do the whole system, updating all 11 javascripts, would take about a half hour. But I usually work on the Library category by category, so in a given day I would only need to update one script. Less than five minutes. I can do that!

Thoughts for the future...

Yes, it is definitely weird to build something like this with just HTML and javascript instead of a database for managing the content and the display. Kludging together a blog for content management and writing javascripts out of a spreadsheet is not the most efficient approach. I know.

Yes, I should learn to code.

Or maybe I will see if my school will hire a student programmer next summer who could turn this kludge into a real program that other people could use for their own content management. Now THAT would be cool. I can definitely imagine this as a system that anybody could use to build an annotated online library for their class.

Meanwhile, I am so happy that I have this randomizer to offer my students for Fall semester. Now I get to keep on adding books until I run out of summer!

Growth Mindset Cat:


  1. Brilliant, Laura. Thanks for sharing this and also for sharing instructions to make a randomizer.

    1. I am glad you like it, Tania! I am really excited to share this with my students... and I still have July to add more books. Whoo-hoo!!! :-)


If the comment form misbehaves, you can also find me at Twitter: @OnlineCrsLady.