Meta Tags Plugin

@pedroborges:

Thanks for your Kirby Meta Tags plugin. To test it I have downloaded a new Kirby Starterkit 2.5.12, installed it, then added a new snippet site/snippets/breadcrumb.php with the source like Kirby docs: Breadcrumb menu, added the needed css for this and added <?php snippet('breadcrumb') ?> in the last line of the snippet site/snippets/header.php.

After this I installed your Kirby Meta Tags plugin, added a new line with <?php echo $page->metaTags() ?> in the “head” of the snippet site/snippets/header.php and added your config to my site/config/config.php.

All works and I get NO error. Thanks.

But I have read https://schema.org/BreadcrumbList, particularly the first two paragraphs.

If I look at the source code e.g. of my page “projects/project-c” I find a difference between the links of the Breadcrumb menu and the links in your BreadcrumbList. Also the numbering is not correct e.g. if the (blog) pages are sorted by date.

Therefore I do not consider your configuration to be correct with the meaning of https://schema.org/BreadcrumbList and suggest the following start of your configuration :

c::set('meta-tags.default', function ($page, $site) {
    $pages = $site->breadcrumb();
    $nn = 0;
    $breadcrumb = [];

    foreach ($pages as $p) {
        $breadcrumb[] = [
            '@type'    => 'ListItem',
            'position' => ++$nn,
            'item'     => [
                '@id'  => $p->url(),
                'name' => $p->title()->value(),
            ],
        ];
    }

I am pleased about your feedback.

HeinerEF