diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml
index 1577024..2f8950e 100644
--- a/.github/workflows/gh-pages.yml
+++ b/.github/workflows/gh-pages.yml
@@ -26,6 +26,9 @@ jobs:
- run: mdbook build
+ - name: Fix navigation paths for production
+ run: ./inject-base-url.sh "" "./book"
+
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.6.4
with:
diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml
index e916ae7..5c6a910 100644
--- a/.github/workflows/preview.yml
+++ b/.github/workflows/preview.yml
@@ -32,10 +32,12 @@ jobs:
- name: Build mdBook site
run: mdbook build
if: github.event.action != 'closed'
- env:
- MDBOOK_OUTPUT__HTML__SITE_URL: /pr-preview/pr-${{ github.event.number }}/
+
+ - name: Inject base URL for PR preview
+ run: ./inject-base-url.sh "/pr-preview/pr-${{ github.event.number }}/" "./book"
+ if: github.event.action != 'closed'
- name: Deploy preview
- uses: rossjrw/pr-preview-action@v1
+ uses: rossjrw/pr-preview-action@v1.6.3
with:
source-dir: ./book/
diff --git a/inject-base-url.sh b/inject-base-url.sh
new file mode 100755
index 0000000..607b905
--- /dev/null
+++ b/inject-base-url.sh
@@ -0,0 +1,92 @@
+#!/bin/bash
+# Script to inject tag into mdBook HTML output
+# Usage: ./inject-base-url.sh
+
+set -e
+
+if [ $# -ne 2 ]; then
+ echo "Usage: $0 "
+ echo "Example: $0 /pr-preview/pr-123/ ./book"
+ exit 1
+fi
+
+BASE_URL="$1"
+BOOK_DIR="$2"
+
+# Remove trailing slash for consistency in replacements
+BASE_URL="${BASE_URL%/}"
+
+# Validate inputs
+if [ ! -d "$BOOK_DIR" ]; then
+ echo "Error: Book directory '$BOOK_DIR' does not exist"
+ exit 1
+fi
+
+# Find all HTML files and prepend base URL to relative asset paths
+find "$BOOK_DIR" -name "*.html" -type f | while read -r html_file; do
+ # Get the directory of the current HTML file relative to book root
+ # This is needed for resolving ./ paths correctly
+ rel_dir=$(dirname "${html_file#$BOOK_DIR/}")
+
+ # Convert ../ relative paths to absolute paths with base URL
+ # This handles paths like: href="../../css/style.css" and href=".././theme/css/style.css"
+ sed -i -E "s|href=\"(\.\./)+|href=\"${BASE_URL}/|g" "$html_file"
+ sed -i -E "s|src=\"(\.\./)+|src=\"${BASE_URL}/|g" "$html_file"
+
+ # Clean up any remaining ./ that may have been left after ../ conversion
+ # This handles cases like ".././theme" which becomes "/base/./theme" and needs to be "/base/theme"
+ sed -i -E "s|href=\"${BASE_URL}/\./|href=\"${BASE_URL}/|g" "$html_file"
+ sed -i -E "s|src=\"${BASE_URL}/\./|src=\"${BASE_URL}/|g" "$html_file"
+
+ # Convert ./ relative paths to absolute paths with base URL
+ # This handles paths like: src="./image.png"
+ if [ "$rel_dir" = "." ]; then
+ # File is in root directory
+ sed -i -E "s|href=\"\./|href=\"${BASE_URL}/|g" "$html_file"
+ sed -i -E "s|src=\"\./|src=\"${BASE_URL}/|g" "$html_file"
+ else
+ # File is in subdirectory, need to include the subdirectory path
+ sed -i -E "s|href=\"\./|href=\"${BASE_URL}/${rel_dir}/|g" "$html_file"
+ sed -i -E "s|src=\"\./|src=\"${BASE_URL}/${rel_dir}/|g" "$html_file"
+ fi
+
+ # Convert simple relative paths (no ../ or ./) to absolute paths with base URL
+ # We need to distinguish between:
+ # 1. Root-relative paths (contain /): cloud/index.html → /base/cloud/index.html
+ # 2. File-relative paths (no /): migrating.html → /base/subdir/migrating.html
+ # Also handles paths with anchors: href="page.html#section" → href="/base/page.html#section"
+ # But avoid converting:
+ # - already absolute paths (starting with /)
+ # - URLs with schemes (http://, https://, mailto:, etc.) - they contain ":"
+ # - standalone anchors (starting with #) - these don't start with letter/number
+
+ # First, handle root-relative paths (paths that contain at least one /)
+ # These are paths like "cloud/index.html" or "kion/features/getting_started.html"
+ sed -i -E "s|href=\"([a-zA-Z0-9][^\":]*)/([^\"]*)\"|href=\"${BASE_URL}/\1/\2\"|g" "$html_file"
+ sed -i -E "s|src=\"([a-zA-Z0-9][^\":]*)/([^\"]*)\"|src=\"${BASE_URL}/\1/\2\"|g" "$html_file"
+
+ # Special case: index.html in navigation always points to root, not relative directory
+ # This fixes the "Home" link in sidebar navigation
+ sed -i -E "s|href=\"index\.html\"|href=\"${BASE_URL}/index.html\"|g" "$html_file"
+
+ # Then, handle file-relative paths (simple filenames without /)
+ # Match paths that start with a letter or number, don't contain a colon or slash
+ # Exclude index.html as it's already handled above
+ if [ "$rel_dir" = "." ]; then
+ # File is in root directory
+ sed -i -E "s|href=\"([a-zA-Z0-9][^\"/:]*)\"|href=\"${BASE_URL}/\1\"|g" "$html_file"
+ sed -i -E "s|src=\"([a-zA-Z0-9][^\"/:]*)\"|src=\"${BASE_URL}/\1\"|g" "$html_file"
+ else
+ # File is in subdirectory, prepend the subdirectory path
+ sed -i -E "s|href=\"([a-zA-Z0-9][^\"/:]*)\"|href=\"${BASE_URL}/${rel_dir}/\1\"|g" "$html_file"
+ sed -i -E "s|src=\"([a-zA-Z0-9][^\"/:]*)\"|src=\"${BASE_URL}/${rel_dir}/\1\"|g" "$html_file"
+ fi
+
+ # Final cleanup: remove any remaining ./ in the middle of paths
+ # This handles cases like "/base/kion/features/./features/" which should be "/base/kion/features/features/"
+ sed -i -E "s|/\./|/|g" "$html_file"
+
+ echo "Converted paths in $(basename "$html_file")"
+done
+
+echo "Done! Prepended base URL '${BASE_URL}' to relative paths in '${BOOK_DIR}'"
diff --git a/src/kion/features/getting_started.md b/src/kion/features/getting_started.md
index 4ccaf2d..3d0a7b2 100644
--- a/src/kion/features/getting_started.md
+++ b/src/kion/features/getting_started.md
@@ -6,7 +6,7 @@ The first thing you will see when you log into Kion is a dashboard. From here, y
## Access your Cloud Accounts
-The most common use for Kion is to access your cloud accounts. You will have one or more [Cloud Access Roles](./features/access_roles.md) assigned to each cloud account. These roles allow you to access the cloud account with various levels of permissions. It is best practice to always use the least-privileged role that allows you to perform the necessary actions.
+The most common use for Kion is to access your cloud accounts. You will have one or more [Cloud Access Roles](./access_roles.md) assigned to each cloud account. These roles allow you to access the cloud account with various levels of permissions. It is best practice to always use the least-privileged role that allows you to perform the necessary actions.
You can access your accounts from many places in Kion, including the dashboard, the projects page, and the accounts page. Look for dropdown menus with a cloud icon to select the account and role you want to access.
@@ -42,7 +42,7 @@ When you select a project, you will have several options at the top of the page
- **Financials** - This tab shows you the budget and spending status for the project. You can manage your budgets and generate reports and graphs.
- **Savings Opportunities** - This tab shows you ways to save money on your cloud spending. It will show you recommendations for Reserved Instances and other cost-saving opportunities.
- **Enforcements** - This tab shows you and enforcements that are in place for the project. Enforcements are alerts or actions triggered by spending conditions, such as a budget being exceeded.
-- **Cloud Management** - This tab allows you to find more information about the Cloud Rules, [Cloud Access Roles](./features/access_roles.md), and related resources that are applied to the project.
+- **Cloud Management** - This tab allows you to find more information about the Cloud Rules, [Cloud Access Roles](./access_roles.md), and related resources that are applied to the project.
- **Compliance** - This tab shows you the compliance posture of the project. It will show you any findings that are present, and give you recommendations on how to fix or suppress them.
- **Users** - This tab shows you the users and groups that have access to the project. This access is separate from any Cloud Access Roles that are assigned to the accounts in the project.
- **Permissions** - This tab shows you the permissions that users and groups have to the project, based on the settings in the Users tab.
diff --git a/theme/index.hbs b/theme/index.hbs
index bb1ffb3..0675fc8 100644
--- a/theme/index.hbs
+++ b/theme/index.hbs
@@ -488,5 +488,86 @@
{{/if}}
{{/if}}
+
+
+