# Pages layout table custom value

**URL:** <https://forum.getkirby.com/t/pages-layout-table-custom-value/33822>\
**Category:** Questions\
**Tags:** v5\
**Created:** [March 20, 2025, 8:09am UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822 "2025-03-20T08:09:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![M\_G](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/m_g/32/12046_2.png) [@M\_G](https://forum.getkirby.com/u/M_G)\
**Post date:** [March 20, 2025, 8:09am UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822/1 "2025-03-20T08:09:47Z")

</div>

**Hey,**

Is there a way to display the title of the selected page in a table layout?

As shown in my screenshot, it currently outputs `"value: '{{ page.uuid }}'"`, but I need it to show the **title** of the page instead of the UUID. 🙂

I already checked the doc - [Pages section | Kirby CMS](https://getkirby.com/docs/reference/panel/sections/pages)

But

```auto
 value: "{{ page.title }}"

```

gives me just the title of the product.

 ![Bildschirmfoto 2025-03-20 um 09.04.51](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/8/864c2ff6f45282508b0c12321c3abd59446d4afd.png)

page.yml

```auto
        sections:
          publishedProducts:
            label: Veröffentliche Produkte
            type: pages
            parent: site.find('produkte/produkte')   
            layout: table
            templates: 
              - product
            columns:
              title:
                label: Title
                width: 1/3
              solution:
                label: Lösung
                width: 1/6
              category:
                label: Kategorie
                width: 1/6

```

product.yml

```auto

      productsolution:
        type: fields
        fields:
          solution:
            label: Produkt Lösung
            type: select
            options: query
            query:
              fetch: site.find('loesungen').children.listed
              value: '{{ page.uuid }}'
              text: '{{ page.title }}'

      productcategory:
        type: fields
        fields:
          category:
            label: Produkt Kategorie
            type: select
            options: query
            query:
              fetch: site.find('kategorien').children.listed
              value: '{{ page.uuid }}'
              text: '{{ page.title }}'

```

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [March 20, 2025, 8:22am UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822/2 "2025-03-20T08:22:36Z")

</div>

I haven’t tested it myself, but an idea could be something like

```yaml
value: "{{ site.find(page.solution).title }}"

```

(As `page.solution` should get you the field value which is an UUID that `site.find()` should resolve to an actual page object)

---

<div class="post-metadata">

**Author:** ![M\_G](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/m_g/32/12046_2.png) [@M\_G](https://forum.getkirby.com/u/M_G)\
**Post date:** [March 20, 2025, 9:22am UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822/3 "2025-03-20T09:22:45Z")

</div>

> [@distantnative](#):
>
> `value: "{{ site.find(page.solution).title }}"`

Work’s. Thank’s 🙂

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [March 20, 2025, 9:44am UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822/4 "2025-03-20T09:44:44Z")

</div>

Actually, just realized since `page.solution` is a field you can also use the `toPage` field method. Might look even cleaner

```yaml
value: "{{ page.solution.toPage.title }}"

```

---

<div class="post-metadata">

**Author:** ![M\_G](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/m_g/32/12046_2.png) [@M\_G](https://forum.getkirby.com/u/M_G)\
**Post date:** [March 25, 2025, 8:10am UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822/5 "2025-03-25T08:10:23Z")

</div>

@distantnative

Is there any way to get the title of muliply site’s?

```auto
publishedSolutions:
            label: Veröffentliche Lösungen
            type: pages
            parent: site.find('kompetenz/losungen')   
            layout: table
            templates: 
              - solution
            columns:
              title:
                label: Title
                width: 1/3
              relatedproducts:
                label: Produkte
                width: 1/6
                # value: "{{ site.find(page.relatedProducts).title }}"
                value: "{{ page.relatedProducts }}"
                # value: "{{ page.relatedProducts.map(productUUID => site.find(productUUID).title).join(', ') }}"
                # value: "{{ page.relatedProducts.map(productUUID => kirby.page('produkte/produkte').find(productUUID).title).join(', ') }}"

```

I tried diffrent ways - with

```auto
value: "{{ page.relatedProducts }}"

```

I get than -page://… -page://… back, but I need the title of each selected relatedproduct.

Maybe you have any idea?

---

<div class="post-metadata">

**Author:** ![fvsch](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/fvsch/32/15908_2.png) [@fvsch](https://forum.getkirby.com/u/fvsch)\
**Post date:** [March 25, 2025, 8:39am UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822/6 "2025-03-25T08:39:19Z")

</div>

To output a text representation of complex fields in a table listing, what I do is:

1. Create a [page model](https://getkirby.com/docs/guide/templates/page-models) class for that page type.
2. Write my own method that returns a string.
3. Call that method in the blueprint (e.g. `value: "{{ page.relatedProductsPanelSummary }}"`).

For instance, it might look like:

```php
<?php

use Kirby\Cms\Page;

class ProductPage extends Page
{
	function relatedProductsPanelSummary()
	{
		$titles = [];
		foreach ($this->relatedProducts()->toPages() as $related) {
			$titles[] = $related->title();
		}
		return implode(', ', $titles);
	}
}

```

In this case it might be doable directly in the blueprint (if the Pages collection resulting from `"{{ page.relatedProducts.toPages }}"` has a built-in string representation that matches your needs). But if not, or if your needs get a bit more complex and you need custom logic to produce a string or HTML output, a custom method works well.

---

<div class="post-metadata">

**Author:** ![M\_G](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/m_g/32/12046_2.png) [@M\_G](https://forum.getkirby.com/u/M_G)\
**Post date:** [March 25, 2025, 8:50am UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822/7 "2025-03-25T08:50:21Z")

</div>

Hey thanks for the code

That work’s for me.  
Is there any change to add a line break?  
I tried \n.

```auto
<?php

use Kirby\Cms\Page;

class SolutionPage extends Page
{
    function relatedProductsPanelSummary()
    {
        $titles = [];
        foreach ($this->relatedProducts()->toPages() as $related) {
            $titles[] = $related->title();
        }
        return implode(', ', $titles);
    }
}

```

Maybe ouput like kirby also did

`<ul class="k-tag-field-preview k-tags-field-preview k-tags"><li><button data-theme="light" type="button" class="k-tag"><!----><span class="k-tag-text">Produkt</span><!----></button></li></ul>`

---

<div class="post-metadata">

**Author:** ![fvsch](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/fvsch/32/15908_2.png) [@fvsch](https://forum.getkirby.com/u/fvsch)\
**Post date:** [March 25, 2025, 9:06am UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822/8 "2025-03-25T09:06:37Z")

</div>

Escapes like `\n` work in PHP but only in double quoted strings, not in single quoted strings.

Note that they would produce a newline in the HTML output, but HTML by default does not treat newlines as line breaks, it collapses whitespace (unless you use some specific CSS with [white-space](https://developer.mozilla.org/fr/docs/Web/CSS/white-space)).

If you want line breaks you probably need to output HTML code with `<br>`s, so you would do something like `return implode("<br>", $titles);`.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [March 25, 2025, 11:44am UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822/9 "2025-03-25T11:44:19Z")

</div>

Add in your column options `type: tags`

---

<div class="post-metadata">

**Author:** ![M\_G](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/m_g/32/12046_2.png) [@M\_G](https://forum.getkirby.com/u/M_G)\
**Post date:** [March 26, 2025, 6:24pm UTC](https://forum.getkirby.com/t/pages-layout-table-custom-value/33822/10 "2025-03-26T18:24:37Z")

</div>

> [@distantnative](#):
>
> `type: tags`

Thank’s.
