Is it possible to use a template as a routing pattern? I’m working on a multi language site where a url can look like this:
I would like to explore the possibility to use a custom routing that directs to a virtual page where both project-1 and 2 is represented on one page instead of having two separate.
As all projects share the same template I think the way to go would be to base the routing on the template instead of a specific page name. But I’m not sure if that is even possible? I’ve tried tweaking this example from the docs to use a page template instead but with no success.
Do anyone of you know if that is possible and if it is, point me in the direction on how to solve it?
So a virtual page that displays only those two subpages, but not all subpages?
The site consists of many profiles with subpages, so the routing shouldn’t direct to a virtual page with all subpages. But it should direct to a page where all subpages with the project template for a specific profile is represented.
Currently the site works like this:
On the front page all subpages from all profiles are represented with a thumbnail that directs to that specific projects page so the url’s can be like this domain.com/sv/members/namnnamesson/project-1 and domain.com/sv/members/anotherperson/project-6
The goal would be to redirect like this:
Not really sure about your structure, a possible route for the above could be
'pattern' => 'members/namnnamesson/projects'
Then you would render a virtual page (or the parent page), where you filter the required subpages by template.
If the route should be more flexible, replace
namnnamesson with a placeholder, see docs for routing.
I’ll give it a go, didn’t think it could be that easy!
The structure of the site is like this: