Reference

Guide

svg()

Includes an SVG file by absolute or relative file path.

svg(string|\Kirby\Cms\File $file): string|bool

Parameters

Name Type Default Description
$file string|Kirby\Cms\File

Return type

string|bool

Example

Since 3.3.0

In addition to a string parameter you can also add a file object:

<?php if ($file = $page->files()->filterBy('extension', 'svg')->first()) :?>
<?= svg($file) ?>
<?php endif ?>

Source code

kirby/config/helpers.php#L705