5
5 Comments

Automated website updates

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!

  1. 1

    This seems really cool! I really want to automate workflows for my blog, and my current thinking is automated Mailchimp campaigns and RSS feeds are the way to go. I'm not sure how to do either right now lol. Did you use PHP to automate handling of arbitrary media? What were the other alternatives you considered?

    1. 1

      I use the PHP imagecreatefromjpeg command to load a JPEG file, since the images I use are photos downloaded from Pixabay, always in JPEG format. I could use imagecreatefrompng, etc. to load a PNG, etc. file instead; so not exactly arbitrary media, but flexible enough!

      I then use the PHP imagettftext command to add text to the images using TrueType fonts, and the imagejpeg command to save the finished image to a file.

      I didn't consider any alternatives since I've used PHP to generate images for the web before and it's pretty easy to implement! But if you don't have your own PHP web site and email scripts, I can imagine you'd find other ways to automate image creation.

      For example, you could create scripts using ImageMagick https://imagemagick.org/ which is very powerful albeit somewhat arcane. And if you're not a coder, I'd look for third-party no-code solutions.

      Good luck!

  2. 1

    Nice, I'm doing the same automation for something else in an other niche.
    About posting to twitter...., are you doing that with your own script ? zapier ? iftttt ? something else ?

    1. 1

      Look forward to seeing what you're making, @Tim12!

      I'm hoping to take on Twitter, Instagram, etc. with my own scripts through their APIs. The recent no-code versus code episode on the IH podcast came to a good conclusion: do whatever fits best with your background. I'm a developer, keen to learn what can be done through these APIs, so that I can integrate social media into future products, so that's the way to go for me!

      I've already run into surprising limitations, though: the Instagram API only allows you to post one image + text, not multiple images as you can do through the Instagram app. I guess they're a bit short-staffed over at Facebook, can't muster the resources to implement a fully-functional API ;-)

      1. 1

        I see. Well, you can make the automation without any code using zapier / iftttt.
        I used to develop automation with API, but such tool are relly easy to use..
        good luck !

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 47 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 27 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments How I Launched FrontendEase 13 comments