swiegmann/kirby-alternate-snippets
最新稳定版本:1.0.0
Composer 安装命令:
composer require swiegmann/kirby-alternate-snippets
包简介
This Kirby CMS-Plugin applies custom snippets based on slugs.
README 文档
README
This Kirby CMS-Plugin applies custom snippets based on slugs.
Summary
- Replaces any snippet for a given slug
- Supports descendant pathes
- Supports multilanguage-setups
- Advantages:
- Control of the frontend output (aka "Art Direction") without content/data-changes in the backend
- Disadvantages:
- In case of slug-changes the snippets must be renamed according the current path
Prerequisites
- Kirby 4+
Installation
Download
Download and copy this repository to /site/plugins/kirby-alternate-snippets.
Git submodule
git submodule add https://github.com/swiegmann/kirby-alternate-snippets.git site/plugins/kirby-alternate-snippets
Composer
composer require swiegmann/kirby-alternate-snippets
Use-Case
You have a snippet-file, e.g. /site/snippets/header.php and want to use a custom snippet for a given slug, e.g. domain.com/some-path/another-path.
Usage
Copy the snippet file with one of the following filenames to apply the snippet to
... exactly the slug:
/site/snippets/[snippet-name]--[slug].php
e.g.: /site/snippets/header--news.php.
You can always apply it to deeper slug-pathes:
/site/snippets/[snippet-name]--[slug]--[slug].php
e.g.: /site/snippets/header--news--culture.php.
... the slug and all subpages of the path:
/site/snippets/[snippet-name]--[slug]--.php
e.g.: site/snippets/header--news--.php.
... exactly the slug for a specific language:
/site/snippets/[snippet-name]--[slug]--[language-code].php
e.g.: site/snippets/header--news--en.php.
... the slug and all subpages of path for a specific language:
/site/snippets/[snippet-name]--[slug]--[language-code]--.php
e.g.: site/snippets/header--news--en--.php.
Global Configuration
Configure global settings in your config.php file:
return [ 'swiegmann.kirby-alternate-snippets' => [ 'enabled' => true ] ];
| Option | Default | Type | Description |
|---|---|---|---|
enabled |
true |
bool | En-/Disable plugin |
License
MIT License Copyright © 2025-present swiegmann
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-14