From 93b115d2da1664ff9cf127c83838278efbca3ed0 Mon Sep 17 00:00:00 2001 From: Simon McKenna Date: Wed, 21 Oct 2026 18:41:44 +1030 Subject: [PATCH] fix: reject a research topic named index.md --- xtask/src/build_site.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xtask/src/build_site.rs b/xtask/src/build_site.rs index 9df5ef1..e8891b4 100644 --- a/xtask/src/build_site.rs +++ b/xtask/src/build_site.rs @@ -609,6 +609,13 @@ impl Site<'_> { fn research_topics(&mut self) -> Vec<(String, String)> { let mut topics = Vec::new(); for path in self.repo.markdown_in(repo::RESEARCH) { + // research/index.md would land on the research overview's page. + if file_name(&path) == "index.md" { + self.errors.push(format!( + "{path}: the research overview takes this page; rename the topic" + )); + continue; + } let Some(text) = self.read(&path) else { continue; }; @@ -1737,6 +1744,19 @@ mod tests { ); } + #[test] + fn a_research_topic_named_index_is_an_error() { + let readme = "# Rust\n\n## Repository layout\n"; + let fixture = Fixture::new() + .file("README.md", readme) + .file("HOUSE-OPINIONS.md", "# House opinions\n") + .file("research/index.md", "# Index\n"); + assert_eq!( + run(&fixture.repo(), &fixture.path().join("out")), + ["research/index.md: the research overview takes this page; rename the topic"] + ); + } + #[test] fn relative_paths_climb_and_descend() { assert_eq!(