Our Buffer Hack for Better Images

It's no secret that we're big fans of the social media manager app Buffer. Buffer lets our whole team contribute to our social efforts by keeping our posting queue nice and organized. However, sometimes even the best tools require some workarounds to help us deal with edge cases that the creators never envisioned. We stumbled across one of these edge cases with our blog recently, and we've cooked up a clever little solution that we think you'll enjoy.

We use the Buffer browser extension whenever we post new content on our blog. It's a quick and easy way for us to get our content loaded into our Buffer queue. However, we kept running into this tiny problem: our blog post hero images would never show up in the browser extension.

At first, this wasn't a huge deal for us. But then, we realized that all of our Facebook posts shared the same couple of images. It turns out that Buffer was able to recognize and scrape the images from the related articles at the bottom of our posts, and was using those images instead of the correct one. With our problem identified, it was time to dive into our code.

Poking around the codebase, it was pretty easy to figure out the problem. In order for our hero images to take up the entire top of the screen and have text floated on them, we used CSS to set the background of our hero image div to be the photo instead of using an <img> tag.

Now we had a choice, we could refactor everything and start using <img> tags, or we could simply add an <img> tag to the top of the page and hide it with some CSS. We ended up going with option 2 for a couple of reasons. First, we're working with the same 24 hours in a day as everyone else, and we didn't have the time for a big refactor. Second, it's a real pain to center text over a responsive image, so that refactor would involve some pretty intensive work or possibly a rework of our entire design. Lastly, the big problem I always had with our initial implementation was that it wasn't very accessible. People who use a screen reader wouldn't know about the image because it was essentially hidden from them. So, while the refactor would have certainly solved this problem, the solution we used also solves it. Putting this altogether, we ended up adding the following line of code to the top of the code block we mentioned earlier.