How to access current $page->title() in custom block?

Hi,
I´m trying to create a pagetitle-block, which »only« outputs the pagetitle of the current page.

I´ve tried to get the current page object directly in vue:
this.$api.site.page.title

Or passing the current page with a custom route:

'routes' => function($kirby) {
  return   [
   [
     'pattern' => 'myplugin/pagetitle',
     'action'  => function () use ($kirby) {
        return $kirby->site()->page()->title();
      }
   ]
]

Without success.

What would be the correct way to do it?

Cheers
Peter

I think something like this in Vue:

this.$store.getters["content/values"]()["title"]
1 Like

Wow, thank you jimbobrjames!

This works.

Is there some secret documentation about this.$black.magic() kirby-vue-api, or did you get that by absorbing the source?

Would love to understand it, but can´t find the entrance.

The kirby team gave me that line a couple of years ago. Im not sure if its in the docs. I believe @distantnative pointed me in the right direction at the time. He might be able to give some insight here.

Whoa… A place to find all these cryptic hidden commands would be reallllyyyyy helpful…