doc(website): Use bash scripts to generate static redirect pages

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel
2023-08-21 08:53:41 +02:00
parent c25e39eb25
commit 54b8f93092
11 changed files with 53 additions and 102 deletions

View File

@@ -42,7 +42,7 @@ jobs:
working-directory: ./
- name: Generate docs
run: make docs
run: make docs redirects
working-directory: ./
- name: Set up Node.js

View File

@@ -42,7 +42,7 @@ jobs:
working-directory: ./
- name: Generate docs
run: make docs
run: make docs redirects
working-directory: ./
- name: Set up Node.js

View File

@@ -72,13 +72,16 @@ install-deps:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/onsi/ginkgo/v2/ginkgo
website: docs
website: docs redirects
cd website && \
yarn build
docs: cunicu
./cunicu docs --with-frontmatter
redirects:
bash ./scripts/generate_vanity_redirects.sh
completions: completions/cunicu.bash completions/cunicu.zsh completions/cunicu.fish
completions-dir:
@@ -95,4 +98,4 @@ clean:
find . -name "*.out" -exec rm {} \;
rm -rf cunicu lcov.info test/logs/ completions/
.PHONY: all cunicu tests tests-watch coverage clean lint install-deps ci completions docs prepare generate website
.PHONY: all cunicu tests tests-watch coverage clean lint install-deps ci completions docs redirects prepare generate website

View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2023 Steffen Vogel <post@steffenvogel.de>
# SPDX-License-Identifier: Apache-2.0
STATIC_DIR="./website/static"
PACKAGES=(
cunicu
gont/v2
go-babel
go-pmtud
go-rosenpass
go-skes
go-openpgp-card
)
function generate() {
mkdir -p "${STATIC_DIR}/${1}"
cat > "${STATIC_DIR}/${1}/index.html" <<EOF
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="go-import" content="cunicu.li/${1} git https://github.com/cunicu/${1/\/v[0-9]/}.git">
<meta http-equiv="Refresh" content="0; url=https://github.com/cunicu/${1/\/v[0-9]/}" />
</head>
<body>
</body>
<!--
SPDX-FileCopyrightText: 2023 Steffen Vogel <post@steffenvogel.de>
SPDX-License-Identifier: Apache-2.0
-->
</html>
EOF
}
for i in "${!PACKAGES[@]}"; do
PACKAGE=${PACKAGES[$i]}
PACKAGE_BASE=${PACKAGE/\/v[0-9]/}
generate ${PACKAGE}
if [ ${PACKAGE} != ${PACKAGE_BASE} ]; then
generate ${PACKAGE_BASE}
fi
done

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="go-import" content="cunicu.li/cunicu git https://github.com/cunicu/cunicu">
<meta http-equiv="Refresh" content="0; url=https://github.com/cunicu/cunicu" />
</head>
<body>
</body>
<!--
SPDX-FileCopyrightText: 2023 Steffen Vogel <post@steffenvogel.de>
SPDX-License-Identifier: Apache-2.0
-->
</html>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="go-import" content="cunicu.li/go-babel git https://github.com/cunicu/go-babel">
<meta http-equiv="Refresh" content="0; url=https://github.com/cunicu/go-babel" />
</head>
<body>
</body>
<!--
SPDX-FileCopyrightText: 2023 Steffen Vogel <post@steffenvogel.de>
SPDX-License-Identifier: Apache-2.0
-->
</html>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="go-import" content="cunicu.li/go-pmtud git https://github.com/cunicu/go-pmtud">
<meta http-equiv="Refresh" content="0; url=https://github.com/cunicu/go-pmtud" />
</head>
<body>
</body>
<!--
SPDX-FileCopyrightText: 2023 Steffen Vogel <post@steffenvogel.de>
SPDX-License-Identifier: Apache-2.0
-->
</html>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="go-import" content="cunicu.li/go-rosenpass git https://github.com/cunicu/go-rosenpass">
<meta http-equiv="Refresh" content="0; url=https://github.com/cunicu/go-rosenpass" />
</head>
<body>
</body>
<!--
SPDX-FileCopyrightText: 2023 Steffen Vogel <post@steffenvogel.de>
SPDX-License-Identifier: Apache-2.0
-->
</html>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="go-import" content="cunicu.li/go-skes git https://github.com/cunicu/go-skes">
<meta http-equiv="Refresh" content="0; url=https://github.com/cunicu/go-skes" />
</head>
<body>
</body>
<!--
SPDX-FileCopyrightText: 2023 Steffen Vogel <post@steffenvogel.de>
SPDX-License-Identifier: Apache-2.0
-->
</html>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="go-import" content="cunicu.li/gont git https://github.com/cunicu/gont">
<meta http-equiv="Refresh" content="0; url=https://github.com/cunicu/gont" />
</head>
<body>
</body>
<!--
SPDX-FileCopyrightText: 2023 Steffen Vogel <post@steffenvogel.de>
SPDX-License-Identifier: Apache-2.0
-->
</html>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="go-import" content="cunicu.li/gont/v2 git https://github.com/cunicu/gont">
<meta http-equiv="Refresh" content="0; url=https://github.com/cunicu/gont" />
</head>
<body>
</body>
<!--
SPDX-FileCopyrightText: 2023 Steffen Vogel <post@steffenvogel.de>
SPDX-License-Identifier: Apache-2.0
-->
</html>