Fix all the redirects!
## The problems
Today, //site/docs/index.md is a redirect to https://docs.bazel.build/versions/3.2.0/bazel-overview.html (because 3.2.0 is the latest release version). This seems fine until you remember that //site/docs/index.md does *not* represent https://docs.bazel.build/index.html, rather https://docs.bazel.build/versions/$ANY_VERSION/index.html ! This means that, for example, even https://docs.bazel.build/versions/2.1.0/index.html will point to the 3.2.0 landing page. Not great.
To make matters more confusing, https://docs.bazel.build/$SOME_PATH is automatically redirected to https://docs.bazel.build/versions/master/$SOME_PATH . This seems undesirable since we want unversioned URLs to redirect to the latest release version, not master. But wait, how come the home page isn't broken? https://docs.bazel.build/index.html redirects to https://docs.bazel.build/versions/master/index.html, which -- thanks to the problem described in the first paragraph -- redirects again to https://docs.bazel.build/versions/3.2.0/bazel-overview.html . It ends up working by a fluke!
Furthermore, //site/docs/index.md, being a markdown file, contains raw HTML. This is actually a subtle time bomb since its indented HTML formatting is incompatible with the popular GitHub flavored markdown, which is the reason why the previous attempt to switch to GFM caused a home page outage.
## The fix
For the first problem, we change //site/docs/index.md to be a redirect to the relative path "bazel-overview.html", which means that the 2.1.0 version of index.html will point to the 2.1.0 version of bazel-overview.html.
For the second problem, we change //site/jekyll-tree.sh to always make the root directory redirects point at the latest released version, instead of master.
For the third problem, we simply make //site/docs/index.md use the redirect layout (this is now possible since we don't have a variable in the redirect target anymore). It's now compatible with *any* markdown format, since it's empty.
Perfect!
RELNOTES:
PiperOrigin-RevId: 313735647
diff --git a/site/BUILD b/site/BUILD
index 603de25..9ff67e9 100644
--- a/site/BUILD
+++ b/site/BUILD
@@ -150,6 +150,7 @@
],
outs = ["jekyll-tree.tar"],
cmd = ("$(location jekyll-tree.sh) $@ " +
+ DOC_VERSIONS[0]["version"].split("-")[0] + " " +
"$(location :jekyll-base) " +
"$(location :skylark-rule-docs) " +
"$(location //src/main/java/com/google/devtools/build/lib:gen_buildencyclopedia) " +