Skip to content

Commit d3bdfd8

Browse files
committed
Enhance: Update GitHub Actions workflow to rewrite config paths and extract unique top-level navigation paths for improved side-nav filtering
1 parent 0a6def2 commit d3bdfd8

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/github-pages-preview.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,19 @@ jobs:
171171
cd _site
172172
173173
# Rewrite config paths for side-nav filtering
174-
if [ -f "localhost+3000/${SITE_PATH}/config" ]; then
175-
perl -i -pe "s|href=\"/${SITE_PATH}/|href=\"/${PATH_PREFIX}/${SITE_PATH}/|g" "localhost+3000/${SITE_PATH}/config"
176-
perl -i -pe "s|href=\"/functional-testing-framework/|href=\"/${PATH_PREFIX}/${SITE_PATH}/functional-testing-framework/|g" "localhost+3000/${SITE_PATH}/config"
177-
perl -i -pe "s|href=\"/guide/|href=\"/${PATH_PREFIX}/${SITE_PATH}/guide/|g" "localhost+3000/${SITE_PATH}/config"
174+
CONFIG_FILE="localhost+3000/${SITE_PATH}/config"
175+
if [ -f "$CONFIG_FILE" ]; then
176+
# Rewrite the main site path
177+
perl -i -pe "s|href=\"/${SITE_PATH}/|href=\"/${PATH_PREFIX}/${SITE_PATH}/|g" "$CONFIG_FILE"
178+
179+
# Extract unique top-level nav paths from config.md pages section
180+
# Looks for patterns like [Label](/path/...) and extracts the first directory segment
181+
grep -oE '\]\(/[^/)]+/' ../content/src/pages/config.md | \
182+
sed 's/](//' | \
183+
sort -u | while read nav_path; do
184+
perl -i -pe "s|href=\"${nav_path}|href=\"/${PATH_PREFIX}/${SITE_PATH}${nav_path}|g" "$CONFIG_FILE"
185+
done
186+
178187
echo "✓ Config paths rewritten"
179188
fi
180189

0 commit comments

Comments
 (0)