Shortcuts to generate social image for blog post
I wanted to save time creating social media images for my blog posts. To automate this task, I used the Apple Shortcuts app. I created multiple shortcuts, one for each category on my blog. The one I am showing you is for the books category.
Shortcut
Step 1: Read the Markdown File
The shortcut begins by reading a markdown file that contains the blog post. The file holds all the text and links used in the post. The shortcut finds a URL that points to a book cover image. This step ensures it picks the right image every time. The shortcut checks the URL is clear and works before moving on.
Step 2: Find the File Name
The shortcut takes the name of the file from the URL it finds. For example, if the URL is https://images.peterspath.net/books/cover.jpg
, it uses cover.jpg
. The shortcut checks the name matches a file on the device. This step prevents mistakes when picking the correct image later. The shortcut adds the name to a variable to use in a later step.
Step 3: Locate the File
The shortcut searches the device for the file using the name it finds. It looks in the images folders to locate it. Once it finds the file, it checks that it opens correctly. This step ensures the right file is ready before adding it to the design.
Step 4: Add to Pixelmator Pro
The shortcut adds the file to the layers of a Pixelmator Pro file. This file already has a background layer and other design elements set up. The shortcut places the book cover on a new layer. It also resizes it to fit the design.
Step 5: Export the Image
The shortcut exports the updated Pixelmator Pro file as a finished image. It chooses the right format and size for social media. The shortcut saves it to a folder where all the social images are kept. This step completes the process, giving a ready-to-use image.
Pixelmator file
You can see that I have named the layers in the Pixelmator file. These layer names are used in the Shortcut to replace images within the layers. This file serves as a template.
Result
I thought it would be fun to create a video showcasing all the images generated. Here is a video of all the social media images created for posts in the books category.
This method saves time. The shortcut removes the need to add images manually for each post. It does the work, leaving me free to write.
Category:
Tags:
Year: