Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:
cp docusaurus-prod.config.js docusaurus.config.js
- name: Build website
run: npm run build

- name: Generate redirects
run: |
chmod +x ./build_redirects/generate_redirects.sh
./build_redirects/generate_redirects.sh build ./build_redirects/redirects.txt ./build_redirects/redirects.ver

- name: Post build renames
run: |
find build/Online%20Help -type f -name "index.html" -execdir cp {} Default.htm \;
Expand Down
84 changes: 84 additions & 0 deletions build_redirects/generate_redirects.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env bash
set -euo pipefail

BUILD_DIR="${1:-build}"
REDIRECTS_FILE="${2:-redirects.txt}"
REDIRECTS_VER_FILE="${3:-redirects.ver}"

if [ ! -d "$BUILD_DIR" ]; then
echo "Build dir '$BUILD_DIR' not found"
exit 1
fi
if [ ! -f "$REDIRECTS_FILE" ]; then
echo "Redirects file '$REDIRECTS_FILE' not found"
exit 1
fi
if [ ! -f "$REDIRECTS_VER_FILE" ]; then
echo "Redirects versions file '$REDIRECTS_VER_FILE' not found"
exit 1
fi

# load all versions
versions=()
while IFS= read -r line || [ -n "$line" ]; do
versions+=("$line")
done < "$REDIRECTS_VER_FILE"


# HTML redirect template (defined once, outside the loop to avoid redefinition)
redirect_html() {
local url="$1"
cat <<EOF
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=${url}">
<link rel="canonical" href="${url}" />
</head>
<body>
<script>
window.location.href = '${url}' + window.location.search + window.location.hash;
</script>
</body>
</html>
EOF
}

while IFS='|' read -r from to || [ -n "$from" ]; do
# skip empty or comment lines
case "$from" in
''|\#*) continue;;
esac

if [[ "$from" == *"{version}"* ]]; then
for version in "${versions[@]}"; do
from_versioned="${from//\{version\}/$version}"

# normalize path: remove leading/trailing slash (root handled separately)
if [ "$from_versioned" = "/" ] || [ -z "$from_versioned" ]; then
target_dir="$BUILD_DIR"
else
from_versioned="${from_versioned#/}"
from_versioned="${from_versioned%/}"
target_dir="$BUILD_DIR/$from_versioned"
fi

mkdir -p "$target_dir"
redirect_html "$to" > "$target_dir/index.html"
done
else
# normalize path: remove leading/trailing slash (root handled separately)
if [ "$from" = "/" ] || [ -z "$from" ]; then
target_dir="$BUILD_DIR"
else
from="${from#/}"
from="${from%/}"
target_dir="$BUILD_DIR/$from"
fi

mkdir -p "$target_dir"
redirect_html "$to" > "$target_dir/index.html"
fi

done < "$REDIRECTS_FILE"
25 changes: 25 additions & 0 deletions build_redirects/redirects.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# add specific redirects or dynamic ones (using {version})
# comments start with #
# list of versions will be taken from redirects.ver
# format of this file is: from/path|to/path

/help versions/All Versions Help/Content/Versions.htm|https://help-archive.quali.com/help versions/All Versions Help/Content/Versions.htm
/help%20versions/All%20Versions%20Help/Content/Versions.htm|https://help-archive.quali.com/help versions/All Versions Help/Content/Versions.htm
/{version}/ST/|https://help-archive.quali.com/Online Help/0.0/TestShell/Content/TSS/TSS.htm
/{version}/RUN/|https://help-archive.quali.com/Online Help/0.0/TestShell/Content/TSR/Tst-Run.htm
/Online%20Help/{version}/Portal/|/

/{version}/Portal/Inventory|/portal/inventory/inventory-dashboard
/{version}/Portal/EnvironmentWorkspace|/portal/sandboxes/sandbox-workspace
/{version}/Portal/ReservationWorkspace|/portal/sandboxes/sandbox-workspace
/{version}/Portal/EnvironmentsCatalog|/portal/blueprints/blueprint-catalog
/{version}/Portal/ReservationsList|/portal/sandboxes/sandboxes-dashboard
/{version}/Portal/ReservationsTimeline|/portal/sandboxes/sandboxes-dashboard
/{version}/Portal/Scheduler|/portal/job-scheduling/job-scheduling-dashboard
/{version}/Portal/Manage|/admin/cloudshell-manage-dashboard/manage-dashboard-overview
/{version}/Portal/ManageApps|/admin/cloudshell-manage-dashboard/manage-app-templates
/{version}/Portal/UsingApps|/intro/features/apps-overview
/{version}/Portal/SaveSandbox|/portal/sandboxes/saved-sandboxes
/{version}/Portal/SaveSandboxOverview|/portal/sandboxes/sandbox-save-and-restore-overview
/{version}/RM|/admin/setting-up-cloudshell/cloudshell-resource-management-client
/help%20versions/|https://help-archive.quali.com/help versions/All Versions Help/Content/Versions.htm
25 changes: 25 additions & 0 deletions build_redirects/redirects.ver
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
0.0
2022.1
2022.1.0.1858
2022.2
2022.2.0.1470
2023.1
2023.1.0.655
2023.2
2023.2.0.1763
2023.3
2023.3.0.979
2024.1
2024.1.0.2480
2024.1.0.2508
2024.1.0.2515
2024.1.0.2534
2024.1.0.2540
2024.1.0.2596
2024.1.0.2603
2024.1.0.2624
2024.1.0.2634
2024.1.0.2650
2024.1.0.2653
2024.1.0.2669
2024.1.0.2682
148 changes: 74 additions & 74 deletions docusaurus-prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,83 +104,83 @@ const config = {
}
],

plugins: [
[
'@docusaurus/plugin-client-redirects',
{
redirects: [
{
to: 'https://help-archive.quali.com/help versions/All Versions Help/Content/Versions.htm',
from: ['/help versions/All Versions Help/Content/Versions.htm', '/help%20versions/All%20Versions%20Help/Content/Versions.htm'],
},
{
to: 'https://help-archive.quali.com/Online Help/0.0/TestShell/Content/TSS/TSS.htm',
from: ['/2022.1.0.1858/ST/', '/2022.2.0.1470/ST/', '/2023.1.0.655/ST/', '/2023.2.0.1763/ST/', '/2023.3.0.979/ST/', '/2024.1.0.2480/ST/', '/2024.1.0.2508/ST/', '/2024.1.0.2515/ST/'],
},
{
to: 'https://help-archive.quali.com/Online Help/0.0/TestShell/Content/TSR/Tst-Run.htm',
from: ['/2022.1.0.1858/RUN/', '/2022.2.0.1470/RUN/', '/2023.1.0.655/RUN/', '/2023.2.0.1763/RUN/', '/2023.3.0.979/RUN/', '/2024.1.0.2480/RUN/', '/2024.1.0.2508/RUN/', '/2024.1.0.2515/RUN/'],
},
{
to: '/',
from: [
'/Online%20Help/2022.1.0.1858/Portal/',
'/Online%20Help/2022.2.0.1470/Portal/',
'/Online%20Help/2023.1.0.655/Portal/',
'/Online%20Help/2023.2.0.1763/Portal/',
'/Online%20Help/2023.3.0.979/Portal/',
'/Online%20Help/2024.1.0.2480/Portal/',
'/Online%20Help/2024.1.0.2508/Portal/',
'/Online%20Help/2024.1.0.2515/Portal/',
],
},
],
createRedirects(existingPath) {
var versions = ["0.0", "2022.1", "2022.1.0.1858", "2022.2", "2022.2.0.1470", "2023.1", "2023.1.0.655", "2023.2", "2023.2.0.1763", "2023.3", "2023.3.0.979", "2024.1", "2024.1.0.2480", "2024.1.0.2508", "2024.1.0.2515"];
// plugins: [
// [
// '@docusaurus/plugin-client-redirects',
// {
// redirects: [
// {
// to: 'https://help-archive.quali.com/help versions/All Versions Help/Content/Versions.htm',
// from: ['/help versions/All Versions Help/Content/Versions.htm', '/help%20versions/All%20Versions%20Help/Content/Versions.htm'],
// },
// {
// to: 'https://help-archive.quali.com/Online Help/0.0/TestShell/Content/TSS/TSS.htm',
// from: ['/2022.1.0.1858/ST/', '/2022.2.0.1470/ST/', '/2023.1.0.655/ST/', '/2023.2.0.1763/ST/', '/2023.3.0.979/ST/', '/2024.1.0.2480/ST/', '/2024.1.0.2508/ST/', '/2024.1.0.2515/ST/'],
// },
// {
// to: 'https://help-archive.quali.com/Online Help/0.0/TestShell/Content/TSR/Tst-Run.htm',
// from: ['/2022.1.0.1858/RUN/', '/2022.2.0.1470/RUN/', '/2023.1.0.655/RUN/', '/2023.2.0.1763/RUN/', '/2023.3.0.979/RUN/', '/2024.1.0.2480/RUN/', '/2024.1.0.2508/RUN/', '/2024.1.0.2515/RUN/'],
// },
// {
// to: '/',
// from: [
// '/Online%20Help/2022.1.0.1858/Portal/',
// '/Online%20Help/2022.2.0.1470/Portal/',
// '/Online%20Help/2023.1.0.655/Portal/',
// '/Online%20Help/2023.2.0.1763/Portal/',
// '/Online%20Help/2023.3.0.979/Portal/',
// '/Online%20Help/2024.1.0.2480/Portal/',
// '/Online%20Help/2024.1.0.2508/Portal/',
// '/Online%20Help/2024.1.0.2515/Portal/',
// ],
// },
// ],
// createRedirects(existingPath) {
// var versions = ["0.0", "2022.1", "2022.1.0.1858", "2022.2", "2022.2.0.1470", "2023.1", "2023.1.0.655", "2023.2", "2023.2.0.1763", "2023.3", "2023.3.0.979", "2024.1", "2024.1.0.2480", "2024.1.0.2508", "2024.1.0.2515"];

if (existingPath.startsWith('/portal/inventory/inventory-dashboard')) {
return versions.map(version => `/${version}/Portal/Inventory`);
}
else if (existingPath.startsWith('/portal/sandboxes/sandbox-workspace')) {
return versions.flatMap(version => [`/${version}/Portal/EnvironmentWorkspace`, `/${version}/Portal/ReservationWorkspace`]);
}
else if (existingPath.startsWith('/portal/blueprints/blueprint-catalog')) {
return versions.map(version => `/${version}/Portal/EnvironmentsCatalog`);
}
else if (existingPath.startsWith('/portal/sandboxes/sandboxes-dashboard')) {
return versions.flatMap(version => [`/${version}/Portal/ReservationsList`, `/${version}/Portal/ReservationsTimeline`]);
}
else if (existingPath.startsWith('/portal/job-scheduling/job-scheduling-dashboard')) {
return versions.map(version => `/${version}/Portal/Scheduler`);
}
else if (existingPath.startsWith('/admin/cloudshell-manage-dashboard/manage-dashboard-overview')) {
return versions.map(version => `/${version}/Portal/Manage`);
}
else if (existingPath.startsWith('/admin/cloudshell-manage-dashboard/manage-app-templates')) {
return versions.map(version => `/${version}/Portal/ManageApps`);
}
else if (existingPath.startsWith('/intro/features/apps-overview')) {
return versions.map(version => `/${version}/Portal/UsingApps`);
}
else if (existingPath.startsWith('/portal/sandboxes/saved-sandboxes')) {
return versions.map(version => `/${version}/Portal/SaveSandbox`);
}
else if (existingPath.startsWith('/portal/sandboxes/sandbox-save-and-restore-overview')) {
return versions.map(version => `/${version}/Portal/SaveSandboxOverview`);
}
else if (existingPath.startsWith('/admin/setting-up-cloudshell/cloudshell-resource-management-client')) {
return versions.map(version => `/${version}/RM`);
}
else if (existingPath.startsWith('/help-versions-archive')) {
return "/help%20versions/"
}
// if (existingPath.startsWith('/portal/inventory/inventory-dashboard')) {
// return versions.map(version => `/${version}/Portal/Inventory`);
// }
// else if (existingPath.startsWith('/portal/sandboxes/sandbox-workspace')) {
// return versions.flatMap(version => [`/${version}/Portal/EnvironmentWorkspace`, `/${version}/Portal/ReservationWorkspace`]);
// }
// else if (existingPath.startsWith('/portal/blueprints/blueprint-catalog')) {
// return versions.map(version => `/${version}/Portal/EnvironmentsCatalog`);
// }
// else if (existingPath.startsWith('/portal/sandboxes/sandboxes-dashboard')) {
// return versions.flatMap(version => [`/${version}/Portal/ReservationsList`, `/${version}/Portal/ReservationsTimeline`]);
// }
// else if (existingPath.startsWith('/portal/job-scheduling/job-scheduling-dashboard')) {
// return versions.map(version => `/${version}/Portal/Scheduler`);
// }
// else if (existingPath.startsWith('/admin/cloudshell-manage-dashboard/manage-dashboard-overview')) {
// return versions.map(version => `/${version}/Portal/Manage`);
// }
// else if (existingPath.startsWith('/admin/cloudshell-manage-dashboard/manage-app-templates')) {
// return versions.map(version => `/${version}/Portal/ManageApps`);
// }
// else if (existingPath.startsWith('/intro/features/apps-overview')) {
// return versions.map(version => `/${version}/Portal/UsingApps`);
// }
// else if (existingPath.startsWith('/portal/sandboxes/saved-sandboxes')) {
// return versions.map(version => `/${version}/Portal/SaveSandbox`);
// }
// else if (existingPath.startsWith('/portal/sandboxes/sandbox-save-and-restore-overview')) {
// return versions.map(version => `/${version}/Portal/SaveSandboxOverview`);
// }
// else if (existingPath.startsWith('/admin/setting-up-cloudshell/cloudshell-resource-management-client')) {
// return versions.map(version => `/${version}/RM`);
// }
// else if (existingPath.startsWith('/help-versions-archive')) {
// return "/help%20versions/"
// }


return undefined; // Return a falsy value: no redirect created
},
},
],
],
// return undefined; // Return a falsy value: no redirect created
// },
// },
// ],
// ],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
Expand Down
Loading
Loading