How Amazon broke my little book club site

Warning: this is a tale of woe.

My book group site is http://tampabaybookgroup.org.

I created and maintained this site just by editing plain HTML for many years. I wanted to do something more sophisticated, but never seemed to get around to it. One day, though, I noticed that some of my old Amazon-generated links were no longer working. Rather than going through and testing them all, I decided to completely rebuild the site using Amazon’s API, so I could be guaranteed of getting good URLs.

What technology to use? I could build it with Rails, but having a database seemed like overkill for such a small site. A Static Site Generator was a much better fit for something like this which changes infrequently – a half dozen times per year or so, as the group’s reading choices are made. So I just had to select between the SSGs that I was familiar with – Hugo and Jekyll. I had wanted to learn more Ruby, and was already a Ruby gem to query Amazon, so I chose Jekyll.

So I rebuilt the site using Jekyll, which made updating it faster – MUCH faster in fact. This worked really well for several years.

Then Amazon limited access to their Advertising API. . And things completely stopped working, with mysterious messages about API limits.

After a bunch of searching, I finally found an explanation on StackOverflow of the Amazon change and the likely impact it would have on sites like mine. I stalled for several months on doing anything, thinking they would see the error of their ways. HAH! No such luck.

I then wrote an appeal letter to Amazon, suggesting they grant an exception to non-profits like my site, which they did not accept.

So I had to take the Jekyll generated pages and extract the common parts so they could be consolidated and loaded using server side includes, and start hand editing the pages again.

And now I’m back where I started. It’s a shame, but there you are.

Static Site Generators and Github Pages

I told you a while ago about my experience building a static site with Hugo.  I was updating the page to show a few changes (notably to my book group website, but also to update the year in the footer).  I stumbled upon a small bug in Hugo’s date reporting, but the real issue that caused me to waste a ton of time was that in my aggravation, I wound up deleting the public folder to ensure a clean start.  But in a Github Pages based site, the public folder should really be a separate Github repo pointing to your target site!

So now I do a quick check in my deployment script to make sure I haven’t accidentally done this again.  Be sure you do something similar!

Note: If you are using Jekyll instead of Hugo, the same advice applies, but you’ll want to check _site instead of public.

Updating my book group website COMPLETE!

So I decided to go with Jekyll, a Ruby based static site generator. I created a new website for my book group, using a gem that makes it easy to autogenerate Amazon affiliate URLs with the Product Advertising API.

I open sourced the project in case anyone else wants to build a book club website, or any other type of website that uses Amazon affiliate links.

Updating my book group website

My beloved book group website is getting the dreaded “not mobile-friendly” warning from Google.  That’s because the site was built when “RWD” meant  “rear-wheel drive,” not “responsive web design!”  But challenge accepted – I will rework the site, and its 17 years of book choices – to be compatible with the modern web.  And you, dear reader, will be lucky enough to follow my adventure!

 

Building a static site on Github with Hugo

The cool kids are using Hugo to build static websites, so I wanted to give it a try myself.   It was easy enough to use locally, but the instructions on the website for Hugo hosting on Github pages were too complicated for me.  So I used what I think is a simpler workflow, and documented it in my site’s README.md.  Here you go:

  1. Install Hugo.
  2. Use
    hugo new site my-site-name

    to create the site. Change directory to my-site-name.

  3. Grab a template you like from HugoThemes. Create the directory themes and install it there.
  4. Run
    hugo server -w

    to start looking at your site locally. Add content until you’re happy.

  5. Fiddle with config.toml until you’re happy. Remember you have to restart “hugo server” each time you change configuration; the LiveReload doesn’t handle this.
  6. Create a .gitignore and add “public” to it.
  7. Add your site to a new git repository. For reference, mine is https://github.com/scottcwilson/hugosite.
  8. Run
    hugo

    to generate the final copy of your site. (I assume you have added your template to the config.toml file; if not, you will need to use “hugo -t your-template”.) Change directory to “public”.

  9. Add this directory to a new repository, with the name your-github-name.github.io. Again, for reference, mine is https://github.com/scottcwilson/scottcwilson.github.io.
  10. You’re done! Your site will be live shortly at http://your-github-name.github.io/”>http://your-github-name.github.io.