doc: add top-level redirect

* Add a script for creating top-level redirects on the
  projectacrn.github.io site.
* Use it to generate the top-level index.html redirect to
  latest/index.html in the Makefile (for make publsh).
* Generate a new redirect for hardware.html to catch inbound links.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
This commit is contained in:
David B. Kinder 2021-10-28 11:01:55 -07:00 committed by David Kinder
parent f64f253562
commit abb564ba41
3 changed files with 30 additions and 13 deletions

View File

@ -92,7 +92,8 @@ publish:
cp -r $(BUILDDIR)/html/* $(PUBLISHDIR)
ifeq ($(RELEASE),latest)
cp scripts/publish-README.md $(PUBLISHDIR)/../README.md
cp scripts/publish-index.html $(PUBLISHDIR)/../index.html
scripts/publish-redirect.sh $(PUBLISHDIR)/../index.html latest/index.html
scripts/publish-redirect.sh $(PUBLISHDIR)/../hardware.html latest/reference/hardware.html
cp scripts/publish-robots.txt $(PUBLISHDIR)/../robots.txt
sed 's/<head>/<head>\n <base href="https:\/\/projectacrn.github.io\/latest\/">/' $(BUILDDIR)/html/404.html > $(PUBLISHDIR)/../404.html
endif

View File

@ -1,12 +0,0 @@
<html>
<head>
<title>ACRN Hypervisor documentation</title>
<meta http-equiv="refresh" content="0; URL=latest/index.html">
<script>
window.location.href = "latest/index.html"
</script>
</head>
<body>
<p>Please visit the <a href="/latest/">latest ACRN documentation</a></p>
</body>
</html>

28
doc/scripts/publish-redirect.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
# Copyright (C) 2021 Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
# Create top-level website redirect to a doc (conf.py redirect script can only
# create redirects within the published folder output, e.g. latest/ or 2.6/)
#
# publish-redirect docname.html destpath/docname.html
if [[ $# -ne 2 ]]; then
echo "Error: $0 expects two parameters: docname.html destpath/docname.html" >&2
exit 1
fi
cat>"$1"<<EOF
<html>
<head>
<title>ACRN Hypervisor documentation Redirect</title>
<meta http-equiv="refresh" content="0; URL=$2">
<script>
window.location.href = "$2"
</script>
</head>
<body>
<p>Please visit the <a href="/latest/">latest ACRN documentation</a></p>
</body>
</html>
EOF