Kirby SEO - Serp preview field for the panel

@tobiasweh @PaulMorel

I think I need your feedback on this.

Idea for how templates can work

This is just an seo title example and would probably not work well in real life.


    type: seo
    title: {{product_name}} has {{product_count}} products in category {{category}}

Now you may wonder what product_name, product_count and category is. It’s what you want it to be, setup by a controller.


One seo controller for each template located in:


It has a subfolder called seo. Maybe that path could be changed by an c::get option.

Controller code

This is code work like any other controller.

return function($site, $pages, $page) {
  return array(
    'product_count' => $page->children()->count(),
    'product_name' => $page->title(),
    'category' => $page->category()

Here you setup an array of the values you want to use in the seo title blueprint. They are then added as a data attribute as JSON in the panel which menas javascript can get the values.

Final words

  • I think it’s better than a snippet because you don’t use HTML, just creating an array.
  • Because you set the array you can format the values before the output. Powerful!
  • If not adding a title template in the blueprint it will fallback to the current title solution.

So, what do you think?