medienbaecker/kirby-mastodon-replies
最新稳定版本:2.0.1
Composer 安装命令:
composer require medienbaecker/kirby-mastodon-replies
包简介
Two-way Mastodon integration for Kirby: post pages from the Panel or CLI, fetch and display replies
README 文档
README
Post Kirby pages to Mastodon from the Panel or CLI. Display replies, stars and boosts on the backend and frontend.
Installation
composer require medienbaecker/kirby-mastodon
Configuration
// site/config/config.php return [ 'medienbaecker.kirby-mastodon' => [ 'instance' => 'https://mastodon.social', 'token' => 'YOUR_APP_TOKEN_HERE', // scope: write:statuses 'post.default' => '{{ page.title }}: {{ page.url }}', ], ];
All options:
| Option | Default | |
|---|---|---|
instance |
Mastodon instance URL | |
token |
App token with write:statuses scope |
|
post.default |
{{ page.title }}\n\n{{ page.url }} |
Default toot text. String or closure receiving the page. Supports page/site query placeholders. The kirby and user globals are intentionally shadowed so user-edited templates can't leak {{ kirby.option('token') }} or similar. |
name |
Mastodon |
Brand name shown in the section labels |
field |
mastodon_url |
Page field that stores the posted toot URL |
cache.ttl |
5 |
Reply cache freshness in minutes. 0 disables. |
Posting
Add the section to a page blueprint:
sections: mastodon: type: mastodon
Before posting the section shows a textarea seeded with post.default, a Preview toggle, and a Post button. After posting it shows reply, boost and favourite counts plus Refresh and Unlink buttons. The { } button opens a dialog listing every supported placeholder. Only the posted URL is stored on the page (in mastodon_url); the toot text itself lives on Mastodon. Unlinking only clears the local field; the toot is left intact.
Or post from the CLI:
kirby mastodon:post path/to/article
kirby mastodon:post path/to/article --text="Custom toot for {{ page.title }}"
Requires composer global require getkirby/cli.
Displaying replies
<?php snippet('mastodon-replies') ?>
The wrapper snippet pulls in sub-snippets for heading, stats, list, reply, outro, empty, and error. Override any of them by placing your own version at site/snippets/mastodon-replies/<name>.php.
Reply data is also available raw via $page->mastodonReplies(), which returns success, url, replies, count, repliesCount, favouritesCount, reblogsCount, and error.
License
MIT
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-03
