-
Notifications
You must be signed in to change notification settings - Fork 10
Model route and url types properly #216
Comments
Some of the link validation might happen in |
This issue may demonstrate the worst case for an internal url change: #339 . |
https://www.spock.li/2015/04/19/type-safe_routing.html and |
Spock/Servant are both very nice but afaik, we don't have something like that in the ocaml ecosystem. However, quite literally as of 2 days ago, the well typed router library was announced on the discuss forum. I haven't looked into it yet, but it's certainly worth investigating. As for my initial thoughts on this issue, I think it's great that we have factored out the url constants as a first step, but I think we could take it further and create a new type to model internal urls. For example, I was thinking something more akin to the following: type t = [
| `Home
| `Blog_post of int
]
val of_string : string -> t
val to_string : t -> string One place I see this breaking down is when the URL path contains additional things, such as type t =
{ lang : Lang.t option
; path : [ `Home | `Blog_post of int ]
} Or model the route in a different way. |
I don't see why that's a break down. Seems perfectly fine to me.
Should it be required? Every page has to be in some language, with |
Review of #327:
|
Another word for an internalurl can be a route. We can think of url as one possible serialization of a route. |
It would be nice to have some specific internal and external url categories like webpage, image, and video. I would use the image url as part of abstracting parameters that will be useful in reusable components. |
If we enumerate all the image url's as well, then we can avoid the need for scripts like the following: https://github.com/ocaml/v3.ocaml.org/pull/471/files#diff-62b8d055d3f221a52d60fcca16f433db5fefa7a87e41423d96b6ff74f21c45a4. |
Merged ocaml/ocaml.org#470 to parameterize links by language. |
Let's go with this assumption. |
Let's skip this. |
We exceeded the time box and have made some improvements in this area. We can create a new issue if there are concrete refinements. |
Uh oh!
There was an error while loading. Please reload this page.
To the extent that it is practical, let's use shared constants, types, and validation logic to ensure that all URL data is a validly formed URL. For URLs to refer to pages within this site, let's also ensure that the URLs always point to valid pages. For URLs referring to external sites, consider ways to validate that the external site exists at site build time.
Some possible tasks:
ood
has already performed this validation.We could validate any internal URLs mentioned in markdown files against a set of valid internal URLs when converting the markdown to html.I don't expect links between tutorials. The tutorial navigation will steer users between tutorials.Time box: 6 hours
The text was updated successfully, but these errors were encountered: