Question: One-pager w/ sub-pages

Hello,

I’m relatively new to Kirby and need some help with setting up subpages in my one-pager.

For context, the site is a music agency, so the plan is to have all of the artists listed as images on the front page, then the user is able to click the images to take them to the individual artist subpage.

My current folder set-up

I’ve gotten as far as listing my artist section on the front page, with each subpage artist listed through the below method.

<?php foreach($data->children()->listed() as $artist): ?>

However, I can’t figure out how to add a redirect when the user clicks on the listed artist image, to take them to an individual artist page. I’m thinking I need to set-up individual templates for the artist, but struggling with the execution.

Will appreciate the support!

Since you access the $artist page object in your snippet, you can link to the artist pages with

<a href="<?= $artist->url() ?>"><?= $artist->title() ?></a>

And yes, you would need a separate template or use the default.php template to display the content of the artist pages.

Thank you!

I implemented this, then added artist.php to my templates and works just fine.