kirby-meta
kirby-meta copied to clipboard
Hide parent page in sitemap but display children
I wonder if it is possible to hide a parent page in the sitemap but to list its children.
Either unlisting the parent page and adding to config:
"fabianmichael.meta.sitemap.pages.includeUnlisted" => [
"parent/*"
],
--> parent is included
or listing the parent and hiding by template or page id with does not help.
"fabianmichael.meta.sitemap.pages.exclude" => [
"parent"
],
--> parent and children are excluded
@the-leonat This is clearly a design-issue of the plugin. You can use the following workaround by adding a hook to you config file:
use FabianMichael\Meta\PageMeta;
use Kirby\Cms\App;
use Kirby\Cms\Page;
return [
'hooks' => [
'meta.sitemap.url' => function (
App $kirby,
Page $page,
PageMeta $meta,
DOMDocument $doc,
DOMElement $url) {
if ($page->is(page('/* find target page here or any other condition */))) {
return false;
}
},
]
];
Version 2.0.0 will not hide child pages any longer, if their parent page is unlisted.