diff --git a/external/book/content/book/az/v2/_index.html b/external/book/content/book/az/v2/_index.html index 12f1ed9bd6..ce410bc097 100644 --- a/external/book/content/book/az/v2/_index.html +++ b/external/book/content/book/az/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/az/v2.html" aliases: - "/book/az/v2/index.html" +- "/book/az/index.html" --- diff --git a/external/book/content/book/be/v2/_index.html b/external/book/content/book/be/v2/_index.html index c4ec6458c5..a53c31551f 100644 --- a/external/book/content/book/be/v2/_index.html +++ b/external/book/content/book/be/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/be/v2.html" aliases: - "/book/be/v2/index.html" +- "/book/be/index.html" --- diff --git a/external/book/content/book/bg/v2/_index.html b/external/book/content/book/bg/v2/_index.html index 3d64bd8c61..cf05d1bcc8 100644 --- a/external/book/content/book/bg/v2/_index.html +++ b/external/book/content/book/bg/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/bg/v2.html" aliases: - "/book/bg/v2/index.html" +- "/book/bg/index.html" --- diff --git a/external/book/content/book/cs/v2/_index.html b/external/book/content/book/cs/v2/_index.html index 18107d828b..0ed563627b 100644 --- a/external/book/content/book/cs/v2/_index.html +++ b/external/book/content/book/cs/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/cs/v2.html" aliases: - "/book/cs/v2/index.html" +- "/book/cs/index.html" --- diff --git a/external/book/content/book/de/v2/_index.html b/external/book/content/book/de/v2/_index.html index a54a61acac..203a2ff4bd 100644 --- a/external/book/content/book/de/v2/_index.html +++ b/external/book/content/book/de/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/de/v2.html" aliases: - "/book/de/v2/index.html" +- "/book/de/index.html" --- diff --git a/external/book/content/book/en/v2/_index.html b/external/book/content/book/en/v2/_index.html index d970fc2862..efd58b9b78 100644 --- a/external/book/content/book/en/v2/_index.html +++ b/external/book/content/book/en/v2/_index.html @@ -16,4 +16,6 @@ url: "/book/en/v2.html" aliases: - "/book/en/v2/index.html" +- "/book/en/index.html" +- "/book/index.html" --- diff --git a/external/book/content/book/es/v2/_index.html b/external/book/content/book/es/v2/_index.html index 397c6fea96..99ab31c41c 100644 --- a/external/book/content/book/es/v2/_index.html +++ b/external/book/content/book/es/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/es/v2.html" aliases: - "/book/es/v2/index.html" +- "/book/es/index.html" --- diff --git a/external/book/content/book/fa/v2/_index.html b/external/book/content/book/fa/v2/_index.html index 59de135cd6..2e3a747fec 100644 --- a/external/book/content/book/fa/v2/_index.html +++ b/external/book/content/book/fa/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/fa/v2.html" aliases: - "/book/fa/v2/index.html" +- "/book/fa/index.html" --- diff --git a/external/book/content/book/fr/v2/_index.html b/external/book/content/book/fr/v2/_index.html index 65a3f9611e..22b0ee2063 100644 --- a/external/book/content/book/fr/v2/_index.html +++ b/external/book/content/book/fr/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/fr/v2.html" aliases: - "/book/fr/v2/index.html" +- "/book/fr/index.html" --- diff --git a/external/book/content/book/gr/v2/_index.html b/external/book/content/book/gr/v2/_index.html index 1ce38d1d8b..0f25c8fe3f 100644 --- a/external/book/content/book/gr/v2/_index.html +++ b/external/book/content/book/gr/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/gr/v2.html" aliases: - "/book/gr/v2/index.html" +- "/book/gr/index.html" --- diff --git a/external/book/content/book/id/v2/_index.html b/external/book/content/book/id/v2/_index.html index 19218ff7bd..15cd20b29a 100644 --- a/external/book/content/book/id/v2/_index.html +++ b/external/book/content/book/id/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/id/v2.html" aliases: - "/book/id/v2/index.html" +- "/book/id/index.html" --- diff --git a/external/book/content/book/it/v2/_index.html b/external/book/content/book/it/v2/_index.html index f17798e9e1..efaf22d965 100644 --- a/external/book/content/book/it/v2/_index.html +++ b/external/book/content/book/it/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/it/v2.html" aliases: - "/book/it/v2/index.html" +- "/book/it/index.html" --- diff --git a/external/book/content/book/ja/v2/_index.html b/external/book/content/book/ja/v2/_index.html index 2677160e24..c7b7d532b7 100644 --- a/external/book/content/book/ja/v2/_index.html +++ b/external/book/content/book/ja/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/ja/v2.html" aliases: - "/book/ja/v2/index.html" +- "/book/ja/index.html" --- diff --git a/external/book/content/book/ko/v2/_index.html b/external/book/content/book/ko/v2/_index.html index c214971268..cc1b5f1668 100644 --- a/external/book/content/book/ko/v2/_index.html +++ b/external/book/content/book/ko/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/ko/v2.html" aliases: - "/book/ko/v2/index.html" +- "/book/ko/index.html" --- diff --git a/external/book/content/book/mk/v2/_index.html b/external/book/content/book/mk/v2/_index.html index 49503fc4a8..0e3c818c8f 100644 --- a/external/book/content/book/mk/v2/_index.html +++ b/external/book/content/book/mk/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/mk/v2.html" aliases: - "/book/mk/v2/index.html" +- "/book/mk/index.html" --- diff --git a/external/book/content/book/ms/v2/_index.html b/external/book/content/book/ms/v2/_index.html index 2fdbf065a1..3791228cd7 100644 --- a/external/book/content/book/ms/v2/_index.html +++ b/external/book/content/book/ms/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/ms/v2.html" aliases: - "/book/ms/v2/index.html" +- "/book/ms/index.html" --- diff --git a/external/book/content/book/nl/v2/_index.html b/external/book/content/book/nl/v2/_index.html index ed1e297aaa..d8070795c2 100644 --- a/external/book/content/book/nl/v2/_index.html +++ b/external/book/content/book/nl/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/nl/v2.html" aliases: - "/book/nl/v2/index.html" +- "/book/nl/index.html" --- diff --git a/external/book/content/book/pl/v2/_index.html b/external/book/content/book/pl/v2/_index.html index 5f8b44c3e8..9c18e2c8dd 100644 --- a/external/book/content/book/pl/v2/_index.html +++ b/external/book/content/book/pl/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/pl/v2.html" aliases: - "/book/pl/v2/index.html" +- "/book/pl/index.html" --- diff --git a/external/book/content/book/pt-br/v2/_index.html b/external/book/content/book/pt-br/v2/_index.html index ba0efbdd75..7f83bf95a2 100644 --- a/external/book/content/book/pt-br/v2/_index.html +++ b/external/book/content/book/pt-br/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/pt-br/v2.html" aliases: - "/book/pt-br/v2/index.html" +- "/book/pt-br/index.html" --- diff --git a/external/book/content/book/pt-pt/v2/_index.html b/external/book/content/book/pt-pt/v2/_index.html index 08eb79c64d..59d5b290ff 100644 --- a/external/book/content/book/pt-pt/v2/_index.html +++ b/external/book/content/book/pt-pt/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/pt-pt/v2.html" aliases: - "/book/pt-pt/v2/index.html" +- "/book/pt-pt/index.html" --- diff --git a/external/book/content/book/ru/v2/_index.html b/external/book/content/book/ru/v2/_index.html index 302fbdb303..fc151e8a2a 100644 --- a/external/book/content/book/ru/v2/_index.html +++ b/external/book/content/book/ru/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/ru/v2.html" aliases: - "/book/ru/v2/index.html" +- "/book/ru/index.html" --- diff --git a/external/book/content/book/sl/v2/_index.html b/external/book/content/book/sl/v2/_index.html index 066cdfb601..06b857e47c 100644 --- a/external/book/content/book/sl/v2/_index.html +++ b/external/book/content/book/sl/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/sl/v2.html" aliases: - "/book/sl/v2/index.html" +- "/book/sl/index.html" --- diff --git a/external/book/content/book/sr/v2/_index.html b/external/book/content/book/sr/v2/_index.html index cecc5076f8..47b2e27305 100644 --- a/external/book/content/book/sr/v2/_index.html +++ b/external/book/content/book/sr/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/sr/v2.html" aliases: - "/book/sr/v2/index.html" +- "/book/sr/index.html" --- diff --git a/external/book/content/book/sv/v2/_index.html b/external/book/content/book/sv/v2/_index.html index f6ac1042f0..41a580911f 100644 --- a/external/book/content/book/sv/v2/_index.html +++ b/external/book/content/book/sv/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/sv/v2.html" aliases: - "/book/sv/v2/index.html" +- "/book/sv/index.html" --- diff --git a/external/book/content/book/tl/v2/_index.html b/external/book/content/book/tl/v2/_index.html index 6cab6df991..db024187c0 100644 --- a/external/book/content/book/tl/v2/_index.html +++ b/external/book/content/book/tl/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/tl/v2.html" aliases: - "/book/tl/v2/index.html" +- "/book/tl/index.html" --- diff --git a/external/book/content/book/tr/v2/_index.html b/external/book/content/book/tr/v2/_index.html index a7bc59ed92..b1fb42071e 100644 --- a/external/book/content/book/tr/v2/_index.html +++ b/external/book/content/book/tr/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/tr/v2.html" aliases: - "/book/tr/v2/index.html" +- "/book/tr/index.html" --- diff --git a/external/book/content/book/uk/v2/_index.html b/external/book/content/book/uk/v2/_index.html index 900b7ea2da..7575cb35c4 100644 --- a/external/book/content/book/uk/v2/_index.html +++ b/external/book/content/book/uk/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/uk/v2.html" aliases: - "/book/uk/v2/index.html" +- "/book/uk/index.html" --- diff --git a/external/book/content/book/uz/v2/_index.html b/external/book/content/book/uz/v2/_index.html index ab9fb17491..4e2800566f 100644 --- a/external/book/content/book/uz/v2/_index.html +++ b/external/book/content/book/uz/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/uz/v2.html" aliases: - "/book/uz/v2/index.html" +- "/book/uz/index.html" --- diff --git a/external/book/content/book/zh-tw/v2/_index.html b/external/book/content/book/zh-tw/v2/_index.html index fadcd5a2e3..3a22c9145d 100644 --- a/external/book/content/book/zh-tw/v2/_index.html +++ b/external/book/content/book/zh-tw/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/zh-tw/v2.html" aliases: - "/book/zh-tw/v2/index.html" +- "/book/zh-tw/index.html" --- diff --git a/external/book/content/book/zh/v2/_index.html b/external/book/content/book/zh/v2/_index.html index 1a1c03787c..51baeba50d 100644 --- a/external/book/content/book/zh/v2/_index.html +++ b/external/book/content/book/zh/v2/_index.html @@ -13,4 +13,5 @@ url: "/book/zh/v2.html" aliases: - "/book/zh/v2/index.html" +- "/book/zh/index.html" --- diff --git a/script/book.rb b/script/book.rb index 4bd3a5386f..67fc2cbb96 100644 --- a/script/book.rb +++ b/script/book.rb @@ -130,7 +130,11 @@ def save front_matter = self.front_matter front_matter["page_title"] = "Git - Book" front_matter["url"] = "/book/#{@language_code}/v#{@edition}.html" - front_matter["aliases"] = [ "/book/#{@language_code}/v#{@edition}/index.html" ] + front_matter["aliases"] = [ + "/book/#{@language_code}/v#{@edition}/index.html", + "/book/#{@language_code}/index.html" + ] + front_matter["aliases"].push("/book/index.html") if @language_code == "en" front_matter["book"]["front_page"] = true front_matter["book"]["repository_url"] = "https://github.com/#{@@all_books[@language_code]}" front_matter["book"]["sha"] = self.sha diff --git a/script/serve-public.js b/script/serve-public.js index c5b2d7e1e5..c206427cf2 100755 --- a/script/serve-public.js +++ b/script/serve-public.js @@ -25,7 +25,14 @@ const mimeTypes = { const handler = (request, response) => { const pathname = decodeURIComponent(url.parse(request.url).pathname); - let filename = path.join(basePath, pathname === "/" ? "index.html" : pathname); + let filename = path.join( + basePath, + pathname === "/" + ? "index.html" + : pathname.endsWith("/") + ? `${pathname}index.html` + : pathname + ); let stats = fs.statSync(filename, { throwIfNoEntry: false }); if (!stats?.isFile() && !filename.match(/\.[A-Za-z0-9]{1,11}$/)) { diff --git a/tests/git-scm.spec.js b/tests/git-scm.spec.js index e8674a84bb..74e3bebf25 100644 --- a/tests/git-scm.spec.js +++ b/tests/git-scm.spec.js @@ -199,7 +199,11 @@ test('manual pages', async ({ page }) => { }) test('book', async ({ page }) => { + await page.goto(`${url}book/`) + await expect(page).toHaveURL(`${url}book/en/v2`) + await page.goto(`${url}book`) + await expect(page).toHaveURL(`${url}book/en/v2`) // Navigate to the first section await page.getByRole('link', { name: 'Getting Started' }).click()