Object dispatch routing
In researchr, pages related to a
Person
are collected in theprofile
page. For example,
- http://researchr.org/profile/eelcovisser/publications
- http://researchr.org/profile/eelcovisser/theses
- http://researchr.org/profile/eelcovisser/bibliographies
This is currently achieved by a single page definition that dispatches on an extra
tab
argument:
page profile(p: Person, tab: String) {
case tab {
“publications” : { … }
“theses” : { … }
…
}
}Such pages become quite complicated. I would rather like to make several separate page definitions that are about the same object, but change their routing such that object is dominating in the URL structure. For example,
page (p: Person) publications() {
// show theses for p
}
page (p: Person) theses() {
// show theses for p
}would lead to the following URLs
This may require some restrictions in the keys that can be chosen for the object (
Submitted by Eelco Visser on 24 November 2013 at 17:51Person
in this case).
Issue Log
The possible clashes would be with defined page names and static content. If there are multiple entity types being used like this, you would also need to specify how to deal with clashes between those. Instead of a different page syntax, which is not very flexible and does not deal with the clashes, we could introduce a routing definition that maps request urls to page calls in whatever way you want. This is similar to the routing DSLs used in many web frameworks.
Yes, a routing DSL is fine. The syntax was just a sketch.
A related issue: it would be nice if we would be able to support linking parts of a site to custom domain name.
routing feature was added, example: https://svn.strategoxt.org/repos/WebDSL/webdsls/trunk/test/succeed-web/routing.app
Log in to post comments