$site->documents()

Returns a $files collection with all documents (pdf, doc, xls, etc.) placed directly in /content

  • return ($files)

Example

<h2>Available PDFs</h2>
<ul>
  <?php foreach($site->documents()->filterBy('extension', 'pdf') as $pdf): ?>
  <li>
    <a href="<?= $pdf->url() ?>">
      <?= $pdf->filename() ?>
      (<?= $pdf->niceSize() ?>)
    </a>
  </li>
  <?php endforeach ?>
</ul>

Is something missing or incorrect? Edit this page on Github…