Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexito4/itemposterpublishplugin
Publish plugin to generate images from your posts. Ideal for Twitter Cards.
https://github.com/alexito4/itemposterpublishplugin
macos opengraph publish-plugin swiftui twitter-cards
Last synced: 1 day ago
JSON representation
Publish plugin to generate images from your posts. Ideal for Twitter Cards.
- Host: GitHub
- URL: https://github.com/alexito4/itemposterpublishplugin
- Owner: alexito4
- License: mit
- Created: 2021-01-29T07:39:53.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-14T12:30:41.000Z (about 2 years ago)
- Last Synced: 2024-11-08T21:24:06.671Z (about 2 months ago)
- Topics: macos, opengraph, publish-plugin, swiftui, twitter-cards
- Language: Swift
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ItemPosterPublishPlugin
![Swift 5.3](https://img.shields.io/badge/Swift-5.3-orange.svg)
![Mac](https://img.shields.io/badge/platforms-mac-brightgreen.svg?style=flat)
Create social images for your posts to have nice Twitter Cards. This is a plugin for [Publish](https://github.com/JohnSundell/Publish).
> ⚠️ Note that the poster generation must run on `MainActor` but `Publish 0.9.0` doesn't support concurrency properly
> and it cause a deadlock.
> You will need a workaround (like this [commit](https://github.com/alexito4/Publish/commit/d76f9a0492af0038e06c01b6bf584df9b4514736)) and make your command
> line tool be async.## Installation
Add the package to your SPM dependencies.
```swift
.package(name: "ItemPosterPublishPlugin", url: "https://github.com/alexito4/ItemPosterPublishPlugin", from: "0.0.1"),```
## Usage
The plugin can then be used within any publishing pipeline like this:
```swift
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()` ).# Author
Alejandro Martinez | http://alejandromp.com | [@alexito4](https://twitter.com/alexito4)