Skip to content

Forbid migration alias in new posts #1629

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

Merged
merged 1 commit into from
May 30, 2025
Merged
Show file tree
Hide file tree
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
5 changes: 1 addition & 4 deletions content/Rust-1.87.0/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
path = "2025/05/15/Rust-1.87.0"
title = "Announcing Rust 1.87.0 and ten years of Rust!"
authors = ["The Rust Release Team"]
aliases = [
"2025/05/15/Rust-1.87.0.html",
"releases/1.87.0",
]
aliases = ["releases/1.87.0"]

[extra]
release = true
Expand Down
1 change: 0 additions & 1 deletion content/Rustup-1.28.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
path = "2025/05/05/Rustup-1.28.2"
title = "Announcing rustup 1.28.2"
authors = ["The Rustup Team"]
aliases = ["2025/05/05/Rustup-1.28.2.html"]
+++

The rustup team is happy to announce the release of rustup version 1.28.2.
Expand Down
1 change: 0 additions & 1 deletion content/inside-rust/compiler-team-new-members-may-2025.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
path = "inside-rust/2025/05/27/compiler-team-new-members"
title = "Announcing five new members of the compiler team"
authors = ["davidtwco and wesleywiser"]
aliases = ["inside-rust/2025/05/30/compiler-team-new-members.html"]

[extra]
team = "the compiler team"
Expand Down
1 change: 0 additions & 1 deletion content/inside-rust/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
path = "inside-rust/2025/04/22/project-director-update"
title = "April 2025 Project Director Update"
authors = ["Carol Nichols"]
aliases = ["inside-rust/2025/04/22/project-director-update.html"]

[extra]
team = "Rust Foundation Project Directors"
Expand Down
25 changes: 25 additions & 0 deletions crates/front_matter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,31 @@ pub fn normalize(
}
}

let path = front_matter.path.as_str();
let date = path.strip_prefix("inside-rust/").unwrap_or(path);
if date > "2025/04/14" {
// Make sure that posts created after the migration to Zola don't have
// the alias for preserving permalinks.
//
// Blog authors would often copy-paste an old post, reusing the
// boilerplate for a new one. In that process, they'd usually preserve
// that alias as well, probably not knowing what it's for. Technically
// such an alias doesn't hurt much, it's just a redirect that isn't
// referenced anywhere. So these aliases were allowed, preferring not to
// bother blog authors with such unimportant stuff.
//
// However, there was a situation where a blog post was merged with
// the wrong publication date because of this. Shortly before merging,
// the date was updated, but it was accidentally changed in the useless
// alias instead of the authoritative `path` key. Because of this
// footgun, we don't allow creating these new aliases anymore.
//
// Blog authors who copy-paste old boilerplate will run into failed CI
// and have to fix it by removing the alias. It's annoying, but better
// than publishing a post with the wrong publication date.
front_matter.aliases.retain(|a| !a.contains(".html"));
}

if front_matter.extra.team.is_some() ^ front_matter.extra.team_url.is_some() {
bail!("extra.team and extra.team_url must always come in a pair");
}
Expand Down