Sitemap with route
arnoson opened this issue · comments
Thanks for the great plugin!
On my website I have all projects inside a projects
folder to have them organzied, but with a custom route they are available as If they were direct children of site (my-site.de/projects/test
will be used as my-site.de/test
). What would be the best way to reflect these short paths in the sitemap?
Thanks, I am happy that you like it.
The plugin relies on the $page->url()
method. You could create a page model for project pages, that returns the short URL instead of the longer one.
https://github.com/fabianmichael/kirby-meta/blob/main/src/Sitemap.php#L73
If you only want to modify the Sitemap, you could use one of the hooks available to alter the Sitemap during generation. It relies on PHP’s DOM API, so you have complete freedom to modify it:
https://github.com/fabianmichael/kirby-meta#metasitemap-hooks
https://github.com/fabianmichael/kirby-meta/blob/main/src/Sitemap.php#L50
$page->url()
is perfect, thanks