Rustdoc Index Page should use not use hard-coded values
Open
Nobody has claimed this yet.
C-discussion
T-rustdoc
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
Code
If we include this script on the top level index.html the page no longer needs to be updated when additional crates are generated.
<script src="./crates.js"></script>
<script>
const ul = document.querySelector("ul.all-items");
for (const crate of window.ALL_CRATES) {
const li = document.createElement("li");
const a = document.createElement("a");
a.href = `${crate}/index.html`;
a.textContent = crate;
li.appendChild(a);
ul.appendChild(li);
}
<script>
<body class="rustdoc mod sys">
<!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]-->
<nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a
class="logo-container" href="./index.html"><img class="rust-logo"
src="./static.files/rust-logo-9a9549ea.svg" alt=""></a></nav>
<nav class="sidebar">
<div class="sidebar-crate"><a class="logo-container" href="./index.html"><img class="rust-logo"
src="./static.files/rust-logo-9a9549ea.svg" alt="logo"></a>
<h2><a href="./index.html">Rustdoc</a><span class="version">1.88.0</span></h2>
</div>
<div class="version">(6b00bc388 2025-06-23)</div>
</nav>
<div class="sidebar-resizer"></div>
<main>
<div class="width-limiter"><rustdoc-search></rustdoc-search>
<section id="main-content" class="content">
<h1>List of all crates</h1>
<ul class="all-items">
<li><a href="c/index.html">c</a></li> <!-- remove this part and insert the script above here. -->
</ul>
</section>
</div>
</main>
</body>
Version
rustdoc 1.88.0 (6b00bc388 2025-06-23)
binary: rustdoc
commit-hash: 6b00bc3880198600130e1cf62b8f8a93494488cc
commit-date: 2025-06-23
host: x86_64-unknown-linux-gnu
release: 1.88.0
LLVM version: 20.1.5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated top-level index.html and the rustdoc entry point that produces it. Compare the current hard-coded crate link with the proposed crates.js-driven list, and verify that adding generated crates no longer requires manually updating index.html.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100