ocaml / ocaml.org

The official OCaml website.
https://ocaml.org
Other
160 stars 316 forks source link

Implement shortlinks #916

Closed yawaramin closed 8 months ago

yawaramin commented 1 year ago

It would be ideal to implement a redirect mechanism to enable shortlinks (similar to vanity URLs). We could include the shortlinks in various tools in the OCaml ecosystem (e.g. compiler, REPL, dune, opam) to direct people to long-form documentation.

E.g. ocaml.org/t/alert

(t for 'topic' but any reasonable alternative would work)

This link would just need to redirect to its corresponding long-form link e.g. in this case https://v2.ocaml.org/manual/alerts.html

If the shortlinks were configurable via a content management system, that would be best. It wouldn't need developer work to manage them.

cuihtlauac commented 1 year ago

If the shortlinks were configurable via a content management system, that would be best. It wouldn't need developer work to manage them.

Could you elaborate a bit on this part? Provide examples or stories?

yawaramin commented 1 year ago

To be honest, I'd consider it a stretch goal. I realize the site is currently using YAML files to store data. And that's OK, shortlinks can be stored as YAML and updated via pull request too, it will just be restricted to developers doing it.

But if we were to use a CMS-like system like let's say PocketBase to store the shortlinks and their expanded forms, then we could have anyone with access to the dashboard manage the shortlinks (or indeed any defined data there). The Dream server would be able to query the shortlinks via the PocketBase HTTP API. The SQLite database backing the PocketBase server could be backed up to cloud storage cheaply using Litestream.

PocketBase shortlinks listing:

PocketBase shortlinks listing

PocketBase editing a shortlink:

PocketBase editing a shortlink