Create social images for your posts to have nice Twitter Cards. This is a plugin for Publish.
⚠️ Note that the poster generation must run onMainActor
butPublish 0.9.0
doesn't support concurrency properly and it cause a deadlock. You will need a workaround (like this commit) and make your command line tool be async.
Add the package to your SPM dependencies.
.package(name: "ItemPosterPublishPlugin", url: "https://github.com/alexito4/ItemPosterPublishPlugin", from: "0.0.1"),
The plugin can then be used within any publishing pipeline like this:
import PublishReadingTime
...
try DeliciousRecipes().publish(using: [
...
.addMarkdownFiles(),
.installPlugin(
.itemPosterPublishPlugin(
viewForItem: { item in
Poster(title: item.title)
},
size: CGSize(width: 1600, height: 840)
)
)
...
])
Note that it must be installed after the Items are created (in this case by addMarkdownFiles()
).
Alejandro Martinez | http://alejandromp.com | @alexito4