定制 medienbaecker/kirby-mastodon-replies 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

Panel section in action: composing a toot with live preview, posting, then watching reply, boost and favourite tiles update with engagement counts.

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

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固