Description
Right now, docs.rs passes --static-root-path=/
to rustdoc, and static files are served directly from the docs.rs root, e.g. https://docs.rs/storage-20220709-1.64.0-nightly-6dba4ed21.js.
It would be aesthetically pleasing if these static files had their own directory. For instance, we could pass --static-root-path=/rustdoc.static/
, and simultaneously change the storage path at which we upload these files to be /rustdoc.static/
. Then static files would be served from URLs like `https://docs.rs/rustdoc.static/storage-20221225-1.68.0-nightly-abc1234567.js.
This does not require any coordinated changes from rustdoc. We could do it today. It happens to harmonize with (but not depend on) rust-lang/rust#101702, which envisions a similar change rustdoc's default output, where static files are put in their own directory.
It does depend on a tweak to how we serve static files, specifically SharedResourceHandler:
Lines 726 to 749 in 802fd8e
SharedResourceHandler considers only the last component of a URL's path when serving ["js", "css", "woff", "woff2", "svg", "png"]
. We could add a small bit of extra logic: If a URL's path begins with /rustdoc.static
, consider the full path.