Skip to content

Commit 23f87c8

Browse files
committed
docs: streamline Jekyll configuration and link management
- Replaced inline JavaScript for fixing links with a separate file for better maintainability. - Updated the create-jekyll-config.sh script to copy the link-fixer JavaScript instead of generating it inline. - Removed outdated link adjustments from fix-docs.sh to simplify the documentation processing. - Added `nav_exclude: true` to schemas/index.md and set `toc: false` in the schema reference for improved navigation control.
1 parent 0ff0e14 commit 23f87c8

6 files changed

Lines changed: 17 additions & 37 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
document.addEventListener('DOMContentLoaded', function () {
2+
// Fix all links that should have the baseurl
3+
document.querySelectorAll('a[href^="/"]').forEach(function (link) {
4+
if (
5+
!link.href.includes('/forms-engine-plugin') &&
6+
!link.href.match(/^https?:\/\//) &&
7+
!link.getAttribute('href').startsWith('/forms-engine-plugin')
8+
) {
9+
const href = link.getAttribute('href')
10+
link.href = '/forms-engine-plugin' + href
11+
}
12+
})
13+
})

.github/scripts/docs/create-jekyll-config.sh

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,22 +152,9 @@ keep_files:
152152
- assets
153153
EOF
154154

155-
# Add Javascript to fix any remaining links
156-
echo "📝 Creating link-fixer JavaScript..."
155+
echo "📝 Copying link-fixer JavaScript..."
157156
mkdir -p site-src/assets/js
158-
cat > site-src/assets/js/fix-links.js << 'EOF'
159-
document.addEventListener('DOMContentLoaded', function() {
160-
// Fix all links that should have the baseurl
161-
document.querySelectorAll('a[href^="/"]').forEach(function(link) {
162-
if (!link.href.includes('/forms-engine-plugin') &&
163-
!link.href.match(/^https?:\/\//) &&
164-
!link.getAttribute('href').startsWith('/forms-engine-plugin')) {
165-
const href = link.getAttribute('href');
166-
link.href = '/forms-engine-plugin' + href;
167-
}
168-
});
169-
});
170-
EOF
157+
cp .github/scripts/docs/assets/js/fix-links.js site-src/assets/js/
171158

172159
# Create custom includes directory to add baseurl meta tag
173160
mkdir -p site-src/_includes

.github/scripts/docs/fix-docs.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,6 @@ for dir in code-based configuration-based; do
138138
}
139139
' "$file" > "$temp_file"
140140

141-
if [[ "$file" == "PAGE_VIEWS.md" ]]; then
142-
sed "${SED_INPLACE[@]}" 's|\(see our guidance on page events\)(\.\./configuration-based/PAGE_EVENTS.md)|\1(/features/configuration-based/PAGE_EVENTS)|g' "$temp_file"
143-
sed "${SED_INPLACE[@]}" 's|\[plugin option\](/forms-engine-plugin/https://|[plugin option](https://|g' "$temp_file"
144-
fi
145-
146-
if [[ "$file" == "PAGE_TEMPLATES.md" ]]; then
147-
sed "${SED_INPLACE[@]}" 's|\[PLUGIN_OPTIONS.md\](../../PLUGIN_OPTIONS.md#custom-filters)|\[Plugin Options](/PLUGIN_OPTIONS#custom-filters)|g' "$temp_file"
148-
fi
149-
150-
sed "${SED_INPLACE[@]}" 's|/forms-engine-plugin/forms-engine-plugin/|/forms-engine-plugin/|g' "$temp_file"
151-
sed "${SED_INPLACE[@]}" 's|/forms-engine-plugin/https://|https://|g' "$temp_file"
152-
153141
lowercase_file=$(echo "$file" | tr '[:upper:]' '[:lower:]')
154142
if [ "$file" != "$lowercase_file" ]; then
155143
echo " Creating lowercase copy: $lowercase_file"

.github/scripts/docs/process-docs.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,6 @@ EOF
226226

227227
echo "✅ Updated SCHEMA_REFERENCE.md with full schema listing"
228228
fi
229-
230-
# Set schemas/index.md to be excluded from navigation
231-
if [ -f "$BASE_DIR/schemas/index.md" ]; then
232-
echo " Updating schemas/index.md to be excluded from navigation"
233-
sed "${SED_INPLACE[@]}" '/^---/a\
234-
nav_exclude: true' "$BASE_DIR/schemas/index.md"
235-
fi
236229
fi
237230

238231
# Check for features directory before processing

docs/features/index.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,3 @@ permalink: /features/
77
---
88

99
# DXT Features
10-
11-
- [Configuration-based Features](configuration-based/)
12-
- [Code-based Features](code-based/)

scripts/generate-schema-docs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ title: Schema Reference
194194
nav_order: 5
195195
has_children: true
196196
permalink: /schemas/
197+
nav_exclude: true
198+
toc: false
197199
---
198200
199201
# Defra Forms Model Schema Reference

0 commit comments

Comments
 (0)