-
Notifications
You must be signed in to change notification settings - Fork 303
Add rendering of the web into a directory #2174
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
base: master
Are you sure you want to change the base?
Conversation
As long as the output is good, I won't be pedantic about the code. So, feel free to go ahead and thanks for working on this! |
Yeah, we've wanted this! |
We should start to think about what this means for the team and rust version bits, which are dynamic. Probably just regen a couple times a day and have a manual trigger. Probably via GitHub actions. |
Yes, deploying from GH actions e.g. once per day, plus triggering the deploy when a release happens, is IMO enough. What about the approach to land this? Are you fine with me completely ripping out Rocket and "atomically" switching to the static web? We could do that using other approaches than Heroku, I suppose. Or do you want the static and dynamic approach to live side-by-side for some time? |
@senekor Any thoughts about how to approach the change? Are you fine with landing a PR that completely switches the website over to a static web (that would be ofc the simplest)? |
Yeah, I'm fine with switching over all at once. |
I think it should be fine as long as you can generate redirects. cc @rust-lang/infra for the Heroku part |
What do you mean by redirects? |
There is some redirect logic in <meta http-equiv="refresh" content="0; url={{ url }}"> |
I see. Hmm, that is a bit hacky, but as a workaround why not, I guess. Depending on the method for static deployment that we choose, we might want to use something better on the webserver layer. |
I would do both the meta refresh and a |
I pushed an MVP, together with GitHub Pages integration. A demo is available here: https://kobzol.github.io/www.rust-lang.org/ Some things missing/unclear:
|
Probably not? The instance is dead for a while, and no one had the bandwidth/motivation to fix it. (It's for translation.) |
Once this PR is ready, we should also update
to daily. I can do that in parallel, just let me know when this is close to ready (or send a PR :D) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't review the code in too much detail. I'm more interested in thoroughly testing the built website once the remaining open questions are resolved.
deploy: | ||
needs: [ build ] | ||
if: github.ref == 'refs/heads/master' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the deploy
branch is the one triggering a deployment. I would be fine with deploying from master. @Manishearth what do you think?
static/scripts/languages.js
Outdated
@@ -21,3 +21,4 @@ function langChange() { | |||
|
|||
nav_dropdown.onchange = langChange; | |||
footer_dropdown.onchange = langChange; | |||
// TODO: language redirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume this is about the pre-2018 locales? @Manishearth, what do you think, can we get rid of the pre-2018 redirects? Seems like it would save us some complexity.
That's indeed a great point. I would like to run some web checker tool to compare the old and new websites and display any differences in content. Looking for some software to do it (also trying Claude to generate such a tool xD). |
I had similar ideas when I was thinking about making the website static. Some kind of web scraper tool that you can point at an URL and it spits out everything it found into a directory. Then you can just compare that with the site you built. That would be cool and give us way more confidence before landing this. But IDK if it's too much work and not worth it just for this. |
Ah, that actually seems much better than comparing the websites directly, just download the old website to a directory and then compare the files on disk. I'll try that. |
Ok I fixed JS language redirection with a non-empty base URL. It should be now possible to host the website under a custom path, e.g. Apart from the old language redirects and maybe some CI changes, everything is ready from my side. I checked the website with some Python download script generated by Claude, apart from whitespace everything looked fine, but more eyes should look at it later, and test the website manually. |
This is an experimental implementation of turning the Rust website from a dynamic website to a static website (a bunch of assets in a directory on disk).
I sketched out a simple API for rendering the individual pages/routes, and got the index and governance pages to work, including translations.
If you agree with the approach, I can continue :)