Migrating Instagram Posts to WordPress

Given, you know, everything, I’m looking to move away from Instagram and consolidate everything I’ve posted there to my WordPress blog. Has anyone come across a good way to do this? It doesn’t look like anyone’s done a plugin or anything like that. I have a rudimentary plan, but thought I’d check in case anyone has already solved this…

Problems with WordPress and Amazon CloudFront

Here’s a fun story. When I originally moved this blog to Amazon Lightsail five years ago, I followed the recommended best practice and installed the AWS for WordPress plugin. I used that to set up an Amazon CloudFront distribution to manage the site’s cache. For several years, everything worked great. Then in September 2022, AWS abandoned the plugin and removed it from WordPress.org. As far as I can tell, they provided no information for users to tell them what to do without it. I continued to use the plugin for sometime, even though this is generally seen as pretty bad security since it’s no longer receiving updates. A few months back, I got tired of my Security scanner blaring at me about this discontinued plugin and deactivated it. The CloudFront distribution still existed and my site continued to work as intended, so I figured it was safe to delete.

As you might guess, there have been consequences. I noticed recently that my site was sometimes caching things too aggressively. I’d write a new blog post and tell Rodd to check it out, but he’d still be seeing the old one for some time. I’m far from a CloudFront expert, but I’ve been looking at my distribution behaviour settings and comparing them to current best practices. This site, for example, recommends using “Origin” for your cache key. My plugin-created distro however uses “Cloudfront-Forwarded-Proto,” “CloudFront-is-Tablet-Viewer,” “CloudFront-is-Mobile-Viewer,” “CloudFront-is-Desktop-Viewer,” and “Host.” For object caching, my distribution had “Use origin cache headers” selected instead of a custom option. Without any documentation from AWS on how their plugin actually worked, all I can theorise is that it must’ve set some sort of header that CloudFront was using, and by deleting the plugin, I’ve mucked up that behaviour.

So what to do? For the meantime, I’ve changed the default behaviour object caching to have a default TTL of 5 minutes. I’ll see if that helps the situation at all. Otherwise I’m going to either have to look at my backups and see if I can reverse-engineer what the plugin was doing, or else figure out how to modify my distribution to work properly without it. Ugh.

iOS Shortcuts for WordPress Bloggers

You may have noticed I’m posting a lot more lately. It’s partly because I’m not working, plus a bit of conscious effort… plus a couple effort-saving shortcuts I’ve set up.

In the past, I used to share images to Instagram and then had an IFTTT applet run to post those images to WordPress as blog posts. I wanted to flip that model and instead first post to my own site, and THEN have the option of sharing to Instagram or other social networks. The solution I’ve landed on is to use an iOS Shortcut as a Share Sheet action. That means I take a photo, click the Share button, and then click the Post with Pic shortcut.

iOS Shortcuts

The Shortcut first prompts me for a Post Title, Post Content, and Image Alt Text. It then converts the image to a JPG and uploads it to the WordPress Media API along with the title and alt text. Next, it creates a new post with the title and content, and sets the newly uploaded image as the Featured Image for the post. It also copies the Post Content to the clipboard and reopens the Share Sheet in case I want to then post the image to Instagram or any other social networks. Lastly, it opens my site so I can see the new post.

Post with Pic ShortcutAs you can see, it’s a pretty lengthy Shortcut. You can download a blank version for yourself from here. There are a few places you’ll need to tweak and customise for your own setup. (I recommend doing that on your laptop rather than trying to do it on the phone directly.) You’ll first need to set up an Application-Specific Password for your WordPress User. There’s a Text action where you’ll need to put in your WordPress username and that application-specific password for authentication. There are also three places where you need to replace [yourdomain] with the URL to your own site. Once you’ve got it updated, click the Info icon and make sure you’ve checked “Show in Share Sheet.” Then you should be good to go! (I built this based on Chuck Grimmett’s Shortcut and helpful blog post.)

And yes, I know that Shortcuts has a “Post to WordPress” action built in. However, I could not get the damn thing to work! I suspect it’s because it uses XML-RPC, and I have that locked down for security. This version with the Rest API works just fine.

Upload Images to WordPress ShortcutThere’s a second Shortcut in the Share Sheet above: Upload Images to WordPress. This is for when I have a number of images I want to use in a post. You can upload through the WordPress iOS app, but I’ve found it clunky and slow. It also defaults to uploading at full resolution too. This shortcut works a lot better. I simply select several images in the Photos app, hit Share, and then the relevant Shortcut. It converts each one to JPG and resizes to 1000px wide before uploading. You can grab it here. Again, you’ll need to put in your username and application password. You’ll also need to put your domain name in for the API URL. You may also need to give it some permissions the first time you run it. Depending on how powerful your server is, you may need to limit how many photos you try to upload at once. Note: this one doesn’t do any titles or alt text. But this is for bulk uploading, and I then add in the metadata when I’m composing the post itself.

I hope you find these useful!

Custom Bluesky and Mastodon usernames with your own domain

I recently went through the process of setting up custom handles/aliases for myself using my domain name on Bluesky and Mastodon. I figure I’ll share the steps here in case anybody else with a similar setup (WordPress on Amazon Lightsail) wants to do the same.

Bluesky

Simply follow the instructions that Bluesky have provided here. In Step 5, you will need to add a TXT record to your domain DNS. If you use Amazon Lightsail, click on the Domains & DNS option and then select the relevant DNS zone (in my case, web-goddess.org).

Lightsail console DNS zone

Then click on the DNS records tab and click the + Add record button.

Lightsail console DNS zone

Change the record type to TXT record and then put in the name and response provided by you by Bluesky. (The “host” is the “Record name,” and the “value” is the “Responds with.”) Click save.

Adding a new TXT record

Wait a little bit — in my experience, 30 seconds is usually sufficient — and then click that Verify DNS Record button in Bluesky. And then you’re done!

In my case, you can now find me at @web-goddess.org on Bluesky.

Mastodon

Mastodon is a slightly more involved process, and it doesn’t change your official server username but rather gives you an alias that you can give out. In my case, my current Mastodon account is @web_goddess@aus.social. However, if I give out an alias instead, then it doesn’t matter if I change servers in the future — you’ll still be able to find me. I was inspired by these posts by Phil Nash and Maarten Balliauw for how to do it.

First, open up a new browser tab and go to this URL, substituting your own Mastodon account values in there:

https://{instance}/.well-known/webfinger?resource=acct:{username}@{instance}

So in my case, I went to https://aus.social/.well-known/webfinger?resource=acct:web_goddess@aus.social. What you’ll get back is a blob of text (JSON). Copy that and set it aside for the moment.

Then go to the Lightsail console and click on the little terminal icon to Connect using SSH to your instance.

Lightsail console

A window with a terminal will appear.

Lightsail terminal

Now you need to go to where the WordPress files are stored for your site. Type in this command in the terminal and hit enter.

cd stack/wordpress/

Important note: The path above is for one of the newer WordPress Bitnami instances. If you have an older instance, the path to where your WordPress files are stored might be different.

Then you’ll need to create a new directory called “.well-known.” (Note the dot in front of the name.) Type in this command and hit enter.

mkdir .well-known/

Then go into that directory. Type in this command and hit enter.

cd .well-known

Now you will need to make a special file called webfinger. Type in this command and hit enter to open a text editor in the terminal.

nano webfinger

This is where you will paste in the blob of JSON text you copied from your Mastodon server. Copy and paste it straight into the editor, and then hit CTRL-X to exit.

The editor will ask if you want to “Save modified buffer?” Type Y for Yes, leave the name as webfinger, and hit enter to save.

You can then exit the Lightsail terminal and close the pop-up window.

exit

If everything worked correctly, you should now be able to go to your own domain and receive the JSON blob back by substituting your domain in this address:

https://{yourdomain}/.well-known/webfinger

In my case, I went to https://www.web-goddess.org/.well-known/webfinger in a browser tab and verified that the JSON was returned.

And that’s it! What does this actually mean? It means I can tell people that my Mastodon username is @kris@web-goddess.org, and if they type that into a search box on Mastodon, it will point them to my official account.

Mastodon search

If I change servers in the future, I’ll just have to update the JSON blob with the correct values from my new Mastodon server, and people will continue to be able to find me from the alias.

New web-goddess theme!

I’ve been feeling like the site needed a new lick of paint, so I spent some time today installing and customising a new theme. I used the Björk theme from Anders Norén, who made my previous theme. My logo remains the awesome one that my friend Matt Hinrichs drew for me many years ago. I also decommissioned my old krishoward.org personal site, moving some of the relevant content here and then changing that domain to a redirect. Please let me know if you find any broken links or anything that looks weird!