New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding redirects to evolution proposals that only require the proposal identifier #367
Comments
A few initial thoughts about this: Currently the Swift Evolution dashboard page gets the parsed data as a JSON file and dynamically generates the bulk of the page in a client-side JavaScript, which also handles all the searching and filtering on the page. For a set of redirects, it would make more sense to process the JSON file and create the redirects while the site itself was being statically generated. (Alternately, it may be easier to query GitHub directly to get the contents of the proposals directly, which has all the necessary info) Since this would happen at site generation we may need to create a custom jekyll plug-in or run some kind of preprocessing script. I believe all redirects in vanilla jekyll are handled as client-side meta refreshes, so we would need one actual html file per proposal. I think it would be preferable to have a server-side redirect, so that would require some investigation. |
Thanks for filing this @dempseyatgithub. I can help implement this if possible. I guess before anything is done, a decision about the best implementation strategy needs making. |
I've just had a look inside the js for the proposals search screen at https://www.swift.org/swift-evolution. Could SE proposal code redirects be handled upon loading a dashboard URL like https://www.swift.org/swift-evolution/#?redirect-se=0401? I can see in the |
It's a good idea! The problem with that is that the data is loaded dynamically on page load which can take a while if your internet connection is slow. Instead of a client-side redirect like this, it would be ideal to have the redirects server-side. Then you would be redirected immediately to the proposal, without having to stop by Swift.org first. |
Good point, yeah! |
Yes, I think server-side redirects are the desired approach. I think we should consider generating the redirects from the JSON provided by https://api.github.com/repos/apple/swift-evolution/contents/proposals. At present I don’t know how often @alexhunsley I took a look at the script you have implemented on your GitHub pages page and that was cleverly done. |
A request came up in the forums for a way to link to swift evolution proposals that uses only the proposal identifier and not the full title slug that is used in the GitHub repository:
https://forums.swift.org/t/se-code-only-links-to-swift-evolution-proposal-files/66843
@xwu reached out from the language steering group to see if it would be possible to add redirects on swift.org that would do this.
For example, to reach the URL:
https://github.com/apple/swift-evolution/blob/main/proposals/0406-async-stream-backpressure.md
which requires knowledge of the exact title slug
0406-async-stream-backpressure
of the proposal filename,a redirect would be hosted by swift.org, something like:
https://swift.org/proposals/0406.html
or
https://swift.org/proposals/SE-0406.html
which would redirect to the proposal on GitHub
Adding this would allow easier construction or automation of URLs to proposals.
The text was updated successfully, but these errors were encountered: