Using readable portion of multiselect options

Hi all. I am using a multiselect field of options to filter projects on my projects page.
It’s working fine but I want to show the option (in this case called the ‘department’) in the title of the page, but use the more readable ‘label’ part of the option ( so in this case ‘Cyber Security’ not ‘cyber-security’).

Currently <?= html($department) ?> works fine for url purposes, it’s just for the title on the page I need to make a concession for.


projects.yml blueprint - multiselect field

  width: 1/2
  label: Departments
  type: multiselect
    corporate: Corporate
    it-telecoms: IT & Telecoms
    document-solutions: Document Solutions
    cyber-security: Cyber Security
    office-interiors: Office Interiors

projects.php controller:

return function($page) {

    $departmentsFilter = param('departments');

    $projects  = $page->children()->unlisted();
    $departments = $projects->pluck('departments', ',', true);

    // filter conditionally
    $projects = $projects
        ->when($departmentsFilter, fn($departmentsFilter) => $this->filterBy('departments', $departmentsFilter, ','));

    return [
        'departmentsFilter' => $departmentsFilter,
        'projects'       => $projects->paginate(99),
        'departments'      => $departments,


Start of projects.php template

  <ul class="selector">
      <a class="dropdown-item" href="<?= url($page->url())?>">View all</a>
    <?php foreach ($departments as $department) : ?>
      <a class="dropdown-item <?php if (html($department) == param('departments')) echo 'active';?>"
      href="<?= url($page->url(), ['params' => ['departments' => $department]]) ?>">
        <?= html($department) ?>
    <?php endforeach ?>

  <h1 class="w-100 title"><?= html($department) ?> <?= $page->title() ?></h1>

You can either get the text labels from the blueprint, see Using blueprints in the frontend | Kirby CMS, example Working with Multiselect in my Template - #4 by texnixe

Or you create a key-value array for ex. in your config and grab it from there.

Thanks for the steer!