Skip to content

Kirby 4.5.0

svg()

Includes an SVG file by absolute or relative file path.

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

Parameters

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

Return type

string|false

Screencast

Working with SVG

Kirby has a few useful helpers to load and embed logos and icons in your site.

This video is loaded from YouTube servers with your consent. Read more…

With $file object

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 ?>