Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        

# ItemPosterPublishPlugin


Status

![Swift 5.3](https://img.shields.io/badge/Swift-5.3-orange.svg)

Swift Package Manager

![Mac](https://img.shields.io/badge/platforms-mac-brightgreen.svg?style=flat)

Publish Plugin


Twitter: @alexito4

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)