January 19, 2020

Automated website updates

Mark Jeffery @markjeffery

How to create content once and automatically publish it to my email subscribers, on my website, on Twitter, on Instagram, etc.?

I've already automated the emails (see my previous update for how I did it). Here's how I automated updating my website with the same content. (Twitter, Instagram, etc. coming soon!)

  1. Automatically generate images with text

I store the text for my Daily Reasons To Quit in a database, and I store the background images on my website. When I started out on January 1, I was putting the text and images together manually, using Affinity Photo (like Photoshop, only much much better and much much cheaper). Since then, I have written a PHP script which runs daily on my website to load the background image for the day, renders the text for the day from the database, and saves the combined images and text.

  1. Automatically generate a page for each day

I use an search-engine-optimized URL for each Daily Reason To Quit, e.g. https://quitworkproject.com/reasons/you-have-an-idea for yesterday's Reason. I use an Apache .htaccess RewriteRule to redirect to a PHP script which generates the page from the text in the database and the automatically generated images. It even includes a Twitter card on the site, using a different image with the 1.91:1 aspect ratio that works best for Twitter, so that I can tweet the day's Reason simply by tweeting the URL.

  1. Automatically generate a gallery of every day so far

The same PHP script that generates the page for each day also generates a gallery of every day so far at https://quitworkproject.com/reasons so that, come 6pm PST every day, the new image for the day is automatically added to the gallery.

This all saves a huge amount of manual work for me, so that I can concentrate on generating the content rather than publishing it.

As ever, if you have any questions about what I did, please ask! And I'd love to hear about what you're doing to automatically publish content!

Loading comments...