mirror of
https://codeberg.org/cunicu/cunicu.git
synced 2025-09-26 21:01:14 +08:00
doc(website): Use bash scripts to generate static redirect pages
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
2
.github/workflows/test-website.yaml
vendored
2
.github/workflows/test-website.yaml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
working-directory: ./
|
||||
|
||||
- name: Generate docs
|
||||
run: make docs
|
||||
run: make docs redirects
|
||||
working-directory: ./
|
||||
|
||||
- name: Set up Node.js
|
||||
|
2
.github/workflows/website.yaml
vendored
2
.github/workflows/website.yaml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
working-directory: ./
|
||||
|
||||
- name: Generate docs
|
||||
run: make docs
|
||||
run: make docs redirects
|
||||
working-directory: ./
|
||||
|
||||
- name: Set up Node.js
|
||||
|
7
Makefile
7
Makefile
@@ -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
|
||||
|
46
scripts/generate_vanity_redirects.sh
Executable file
46
scripts/generate_vanity_redirects.sh
Executable 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
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
Reference in New Issue
Block a user