Route to .xml or .xsl

I’m catching everything in a route but want to let a few things through like sitemap.xml and sitemap.xsl. If I say return go($uid) it’s an infinite loop, and if I say return site->visit($uid) it goes to error page not found because there is no template related to those files.

I need kirby to ignore these two $uids in the route, and continue loading as normal so the route from the sitemap plugin can catch these. Unfortunately, my pattern is array('/(:all)', '(any)') and catches everything. What is the command to continue routing as usual if I don’t want to do anything with these urls? I’m need a method that says, kirby continue normal routing process.

I think a route filter can do that.

@texnixe thank you. Some general routing questions: how is registering a new router different than running $kirby->set('route', array(...?

From the documentation, it seems like there are three steps here:

  1. Register the new router
  2. Apply the filter
  3. Run the router

And if I’m making a new router and running it, what happens to the old kirby router? Which one gets applied first?

You don’t have to create your own router, it should actually work in a standard config setting, see these two answers from the same thread for possible solutions:

1 Like