Output label blueprint


I tried to display the output of a selectbox in the a blueprint. But for some reason the output is without capitals. I know I can fix it with css capitalize but I want to know why this happens.


    label: Favorite Colour
    type: select
      blue: Blue
      red: Red


 <?php foreach($jobs = $page->children()->listed() as $job): ?>
            <a href="<?= $job->url() ?>" class="card card-body">
              <div class="col-auto col-md">
                <h6 class="mb-0"><?= $job->title() ?></h6>
              <div class="col-auto col-md-3">
                <?= $job->company() ?>
               <?php endforeach ?>

Output is:

Title for Job

So red is without a capital.

When you use key/value pairs for your options like blue: Blue, then blue is what is stored in your content file, and Blue what is shown to the user in the Panel.

There are several ways to solve this:

  • Capitalizing the first letter in the template <?= Str::ucfirst($job->company()) ?>
  • Use capital letters in your keys (or only capitalized keys), Blue: Blue
  • Get the value from blueprint using $page->blueprint(), in this case, this would be overengineering it, so not recommended
  • in a multilang environment, use language variables (for simple stuff like the example, not recommended either, but I don’t know your exact use case)
  • similar to the last, use key/value pairs in your config

Maybe you don’t use simple blue: Blue examples, then a real world example would be more useful to find the best solution.

1 Like

Hi @texnixe,

Thanks for your help! I was able to fix it with your suggestions. :pray:
I try to recreate a website to understand Kirby better.

Thanks again!