Closed havardlj closed 2 years ago
That's not possible, but you can try something like this (not tested, but I think it should work):
'elements' => [
'nav' => [
'elementType' => \craft\elements\Entry::class,
'criteria' => [
'relatedTo' => [
'sourceElement' => \craft\elements\GlobalSet::find()->handle('globalNav'),
'field' => 'navMatrix'
],
],
'params' => ['changefreq' => 'daily', 'priority' => 0.5],
],
],
Alternatively, you could create your own, custom sitemap using a Twig template, and add it using the additionalSiteMaps
key.
Is there any way of rendering the sitemap from the navigation matrix field I have in my globals, where I could add another field for the priority? I read that rendering functions is a feature that's exclusive to additionalMeta, but I was hoping to do a loop that would output something like (pardon this weird mix of php and twig):
'custom' => [ {% for link in globalNav.navMatrix %} '/{{ link.uri }}' => ['changefreq' => 'weekly', 'priority' => {{ link.priority}} ], {% endfor %} ]