medienbaecker/kirby-mastodon-replies
最新稳定版本:1.0.0
Composer 安装命令:
composer require medienbaecker/kirby-mastodon-replies
包简介
Fetch and display Mastodon replies on your Kirby pages
README 文档
README
A Kirby CMS plugin that fetches and displays Mastodon replies.
Installation
Download
Download and copy this repository to /site/plugins/kirby-mastodon-replies.
Composer
composer require medienbaecker/kirby-mastodon-replies
Usage
1. Add a field to your content
Add a Mastodon post URL to your content file:
Mastodon_url: https://mastodon.social/@username/123456789
If you're using the Panel, add a field to your blueprint:
fields: mastodon_url: label: Mastodon URL type: url
2. Display replies in your template
<?php snippet('mastodon-replies') ?>
I tried to make it easy to override the plugin's markup. You can add snippets to your site for all of these parts:
site/snippets/mastodon-replies.php
site/snippets/mastodon-replies/empty.php
site/snippets/mastodon-replies/error.php
site/snippets/mastodon-replies/heading.php
site/snippets/mastodon-replies/list.php
site/snippets/mastodon-replies/outro.php
site/snippets/mastodon-replies/reply.php
Configuration
return [ 'medienbaecker.kirby-mastodon-replies' => [ 'field' => 'mastodon_url', // Field name for Mastodon post URL 'date.format' => 'd.m.Y H:i:s' // Date format for reply timestamps ] ];
Caching and performance
Consider enabling Kirby's page cache so we're not sending every request to Mastodon's API:
return [ 'cache' => [ 'pages' => true ] ];
On my site I've also added a cronjob that flushes the pages cache regularly. Alternatively you can use MastodonReplies::fetch($url) in an AJAX route and handle caching there.
License
MIT
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-03