Skip to content

Latest commit

 

History

History
64 lines (43 loc) · 1.61 KB

README.md

File metadata and controls

64 lines (43 loc) · 1.61 KB

Twig Plugin for Kirby CMS

  • Adds support for Twig templates to Kirby CMS (2.3+).
  • PHP templates still work, you don’t have to rewrite them if you don’t want to.

What it looks like

Before:

<?php /* site/templates/hello.php */ ?>
<h1><?php echo $page->title() ?></h1>
<?php echo $page->text()->markdown() ?>

After:

{# site/templates/hello.twig #}
<h1>{{ page.title }}</h1>
{{ page.text.markdown | raw }}

Installation

If you’re using Kirby’s CLI, you can install with:

kirby plugin:install fvsch/kirby-twig

For manual installation:

  1. Download the latest release and put it in your site/plugins folder.
  2. Rename the copied folder to twig (it should be named site/plugins/twig).
  3. To activate the plugin, put c::set('twig', true); in your site/config/config.php.

You can now create .twig templates in your site/templates directory.

Documentation

Credits