Releases: medienbaecker/kirby-mastodon
2.0.2
2.0.1
Large numbers for replies, boosts and favs are now getting formatted properly. I've also recorded a GIF.
2.0.0
This release renames the plugin from medienbaecker/kirby-mastodon-replies to medienbaecker/kirby-mastodon and adds posting on top of the existing reply integration.
The page method $page->mastodonReplies(), the mastodon-replies snippet and all of its sub-snippets keep their old names, so reply-only setups need no template changes.
Migrating from kirby-mastodon-replies
composer remove medienbaecker/kirby-mastodon-replies
composer require medienbaecker/kirby-mastodonConfig keys move from medienbaecker.kirby-mastodon-replies.* to medienbaecker.kirby-mastodon.*.
New: posting
A custom Panel section (type: mastodon) with a compose form, a togglable live preview, and a placeholder help dialog. After posting it shows reply, boost and favourite counts plus refresh and unlink buttons.
sections:
mastodon:
type: mastodonConfigure the instance and a write:statuses token, plus an optional default for the toot text:
'medienbaecker.kirby-mastodon' => [
'instance' => 'https://mastodon.social',
'token' => 'YOUR_APP_TOKEN_HERE',
'post.default' => '{{ page.title }}: {{ page.url }}',
],post.default accepts a string or a closure receiving the page. Both are passed through Str::template, so page and site query placeholders are resolved at post time. The kirby and user globals are intentionally shadowed so user-edited templates can't leak {{ kirby.option('token') }} or similar.
The posted toot URL is stored on the page in mastodon_url (configurable via the field option). The new name option controls how the section labels itself ("Post on Mastodon" / "Mastodon Post").
A kirby mastodon:post path/to/page command is also available for headless or scripted posting (requires composer global require getkirby/cli).
Replies: counts and SWR cache
$page->mastodonReplies() now also returns repliesCount, favouritesCount and reblogsCount. These are rendered above the reply list via the new mastodon-replies/stats sub-snippet (override or empty it to hide).
The cache strategy switched to stale-while-revalidate. After the first fetch every render returns instantly. Once cache.ttl minutes pass the next render still returns the cached value and triggers a background refresh, so no user has to pay for the cache miss on subsequent visits.
1.0.0
Add README