I’m building myself a new portfolio site and have made custom thumbnails for my projects but I don’t want the image used for the thumbnail to show up on the project page. Is there a way of doing this?
I’m using the Kirby Starterkit Template
Project.PHP
<?php snippet('header') ?>
<main class="main" role="main">
<header class="wrap">
<h1><?= $page->title()->html() ?></h1>
<div class="intro text">
<?= $page->year() ?>
</div>
<hr />
</header>
<div class="text wrap">
<?= $page->text()->kirbytext() ?>
<?php
// Images for the "project" template are sortable. You
// can change the display by clicking the 'edit' button
// above the files list in the sidebar.
foreach($page->images()->sortBy('sort', 'asc') as $image): ?>
<figure>
<img src="<?= $image->url() ?>" alt="<?= $page->title()->html() ?>" />
</figure>
<?php endforeach ?>
</div>
<?php snippet('prevnext') ?>
</main>
<?php snippet('footer') ?>
One option is to prefix or suffix the thumbnail image with something so the full name is project-thumb.jpg, then setup a custom filter letting you filter on it described here
Another, messier way is to use to use a field in a files meta data to set a field and then filter on that.
As a side note, this is better way to do your alt tags, rather then using the page title. Using file fields will let you set a alt tag value for each image.
Well it does by not having a thumbnail image in the set files on the page in the first place, its getting Kirby to generate the thumbnail on the fly instead, removing the need to bother with a filter.
I had the same use case in my portfolio and I solved it adding a filter and panel fields, and it works like a charm. I can share the code if you want @Brighurst (I don’t have it right now).
(featured image is also the thumbnail image on project list)