One Pager Template Title

Hope you are all well.

Experimenting with one pager and that is well.

Would like to display the title of the one pager block (not the content title; the block title) in the list of active one pager blocks. The default is:

info: "{{ page.intendedTemplate }}"

Which displays the name of the template file. That is dandy but.

I would like to display the Template title in manner that would be something like this:

info: "{{ page.intendedTemplate->title() }}"

The above example fails to display anything and I guess it should display the content title if it would work which is not what I would like. I would like the template (block) title itself.

Been around looking for material and found nothing. Thats why I came here looking for you.

Best
-j

You can create a page method and return the blueprint title like this:

'pageMethods' => [
  'blueprintTitle' => function () {
    return $this->blueprint()->title();
  }
]

info: "{{ page.blueprintTitle }}"

Thank you @thguenther.

That would apply to the front-end nicely. What I seek is for the panel/backend. Template name on the right which I would like to replace with more human friendly template title.

What makes you think this is for the frontend? You can use custom page methods in your blueprint :slight_smile:

1 Like

Gonna test that one. Thanks again @thguenther

Bless your pea-pickin little heart! @thguenther

If you can’t run with the big dogs, stay under the porch. Works like a charm.

To clarify for further/future reference:

1. Make a folder in the plugins section with a name to your taste and a index.php in it.

2. C/P @thguenther scriptlet in it like so:

<?php
Kirby::plugin('my/page-methods', [
  'pageMethods' => [
    'blueprintTitle' => function () {
      return $this->blueprint()->title();
    }
  ]
]);

3. Insert into blueprint of choice the

info: "{{ page.blueprintTitle }}"

4. Enjoy life and be thankful.

1 Like