LivelyKernel / LivelyKernel/lively.next
Routing in `lively.next`
- Dominant language
- JavaScript
- Stars
- 90
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
This is more of a brain dump as of now, as I do not have a good solution to the problem yet. However, the following is something I want to continuously think about while working on the relaunch of the lively web page:
When building static websites, as opposed to truly interactive applications, one needs the capability to route between different URLs. The two most important benefits this brings is that
1. It is possible to link to specific places on the site.
2. One can use the browsers "back" button in the expected way.
For SPAs such as lively applications, the easiest and most flexible way of doing is by using hash routing.
The current way I implement this in the website is by instantiating multiple `HashRouter` instances (a class I implemented inside of the website project) which manage different prefixes of the page (e.g., there is a router solely responsible for all things under the /blog prefix). Then, I write specific bindings for every UI elements that should route somewhere.
The question this bags is twofold:
1. Can we streamline this to provide an easily pluggable solution so that not every page needs to write all this boilerplate code?
2. In the case that we cannot do 1, what is the cleanest way to order this boilerplate code, so that we can provide a passable "cook book" for this problem.
Contributor guide
Assessment
This issue has not been assessed yet.