1

I'm having two contenttypes, but in both I don't want the contenttype slug in the URL. So both contenttypes should match /{slug}, but take the content from a differtent contenttype.

So I though, I create two routes, if the first fails, it will try the second:

# match on any landingpage created as a contenttype landingpage
landingpagebinding:
    path: /{slug}
    defaults:
        _controller: controller.frontend:record
        contenttypeslug: landingpage
    contenttype: landingpage

# match on any actionpage created as a contenttype actionpage
actionpagebinding:
    path: /{slug}
    defaults:
        _controller: controller.frontend:record
        contenttypeslug: actionpage
    contenttype: actionpage

So I have:

  • a landingpage "/this-is-my-landingspage"
  • a actionpage "/this-is-my-actionpage"

The landingpage is working, the actionpage gives a 404 error

landingpage/this-is-my-actionpage not found.

Why do I get a 404 on the landingpagebinding? I expected it would continue to the next route, actionpagebinding and tries to match on that. If that is also not found, then I want a 404 error!

Note: I know that when both contenttypes have the same slug, the first one will match. But that is not an issue.

Timo002
  • 3,138
  • 4
  • 40
  • 65

1 Answers1

0

I had the same problem with this. you will have to write a function that picks up the next slug if the one before has not been found.

what bolt does is just check the first option and then stops. you have to write some function that lets it continue reading until it found the wanted file.

B. Dionys
  • 916
  • 7
  • 34