Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions xtask/src/build_site.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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!(
Expand Down
Loading