$site->file($filename)

Searches for a specific file placed directly in /content by filename

  • return ($file)

Example

Fetching the first file

<?php if($file = $site->file()): ?>
<a href="<?= $file->url() ?>">
  <?= html($file->filename()) ?>
</a>
<?php endif ?>

Fetching a specific file

<?php if($file = $site->file('myfile.pdf')): ?>
<a href="<?= $file->url() ?>">
  <?= html($file->filename()) ?>
</a>
<?php endif ?>