Skip to content

JavaScript URLs

Used by the js() helper

/site/plugins/js-helper/index.php
Kirby::plugin('my/js', [
  'components' => [
    'js' => function (Kirby $kirby, string $url, $options = null): string {
      // create fingerprint for cache busting
      $fingerprint = md5_file($url);
      return $url . '?' . $fingerprint;
    }
  ]
]);

Parameters

Name Type Default Description
$kirby * Kirby\Cms\App Kirby instance
$url * string Relative or absolute URL
$options string|array null An array of attributes for the link tag or a media attribute string

Return type

string