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