Skip to content

Commit 7ca917d

Browse files
committed
update-book2: let https://git-scm.com/book/ redirect
Instead of 404'ing, this URL should redirect to https://git-scm.com/book/en/v2 automatically, similarly the intermediate URL https://git-scm.com/book/en/. Analogous redirects are also needed for the translated versions of the book. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 9e694c5 commit 7ca917d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

script/book.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ def save
130130
front_matter = self.front_matter
131131
front_matter["page_title"] = "Git - Book"
132132
front_matter["url"] = "/book/#{@language_code}/v#{@edition}.html"
133-
front_matter["aliases"] = [ "/book/#{@language_code}/v#{@edition}/index.html" ]
133+
front_matter["aliases"] = [
134+
"/book/#{@language_code}/v#{@edition}/index.html",
135+
"/book/#{@language_code}/index.html"
136+
]
137+
front_matter["aliases"].push("/book/index.html") if @language_code == "en"
134138
front_matter["book"]["front_page"] = true
135139
front_matter["book"]["repository_url"] = "https://github.com/#{@@all_books[@language_code]}"
136140
front_matter["book"]["sha"] = self.sha

0 commit comments

Comments
 (0)