Skip to content

Commit 26b4636

Browse files
committed
feat: generate index pages for api/ and api/{framework}/
After doc generation, scan the existing version directories and build index.html pages listing all available versions. This makes /api/, /api/openui5/, and /api/sapui5/ navigable instead of 404.
1 parent 2caf875 commit 26b4636

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

‎.github/workflows/generate-api-docs.yml‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,72 @@ jobs:
151151
echo "All versions up to date — nothing to generate"
152152
fi
153153
154+
- name: Update index pages
155+
working-directory: gh-pages
156+
run: |
157+
BASE="https://ui5.github.io/typescript/api"
158+
159+
# Start building api/index.html
160+
cat > api/index.html << 'EOF'
161+
<!DOCTYPE html>
162+
<html lang="en"><head>
163+
<meta charset="utf-8">
164+
<title>UI5 TypeScript API Reference</title>
165+
<meta name="description" content="Crawlable TypeScript API documentation for OpenUI5 and SAPUI5">
166+
<meta name="viewport" content="width=device-width,initial-scale=1">
167+
<link rel="canonical" href="https://ui5.github.io/typescript/api/">
168+
<style>body{font-family:system-ui,-apple-system,sans-serif;max-width:56em;margin:0 auto;padding:2em;line-height:1.6;color:#1a1a2e}a{color:#0366d6;text-decoration:none}a:hover{text-decoration:underline}h1{border-bottom:2px solid #e1e4e8;padding-bottom:0.3em}h2{margin-top:2em}table{border-collapse:collapse;width:100%}th,td{text-align:left;padding:0.5em 1em;border-bottom:1px solid #e1e4e8}th{background:#f6f8fa}nav{font-size:0.9em;margin-bottom:1.5em}</style>
169+
</head><body>
170+
<nav><a href="../">← UI5 &amp; TypeScript</a></nav>
171+
<h1>UI5 TypeScript API Reference</h1>
172+
<p>Generated from <code>@openui5/types</code> and <code>@sapui5/types</code> type definitions.</p>
173+
EOF
174+
175+
for FRAMEWORK in openui5 sapui5; do
176+
[ -d "api/${FRAMEWORK}" ] || continue
177+
TITLE=$( [[ "$FRAMEWORK" == "openui5" ]] && echo "OpenUI5" || echo "SAPUI5" )
178+
PKG=$( [[ "$FRAMEWORK" == "openui5" ]] && echo "@openui5/types" || echo "@sapui5/types" )
179+
180+
# Collect versions (directories containing a .version file), sorted newest first
181+
ROWS=""
182+
for VDIR in $(find "api/${FRAMEWORK}" -maxdepth 1 -mindepth 1 -type d | sort -t. -k2 -rn); do
183+
DIR_NAME=$(basename "$VDIR")
184+
if [ -f "${VDIR}/.version" ]; then
185+
FULL_VER=$(cat "${VDIR}/.version")
186+
ROWS="${ROWS}<tr><td><a href=\"${FRAMEWORK}/${DIR_NAME}/index.html\">${FULL_VER}</a></td><td>${DIR_NAME}</td></tr>"
187+
fi
188+
done
189+
190+
[ -z "$ROWS" ] && continue
191+
192+
# Append framework section to main index
193+
cat >> api/index.html << EOF
194+
<h2>${TITLE}</h2>
195+
<p>Package: <code>${PKG}</code></p>
196+
<table><thead><tr><th>Version</th><th>Release Line</th></tr></thead><tbody>${ROWS}</tbody></table>
197+
EOF
198+
199+
# Create framework-specific index
200+
cat > "api/${FRAMEWORK}/index.html" << EOF
201+
<!DOCTYPE html>
202+
<html lang="en"><head>
203+
<meta charset="utf-8">
204+
<title>${TITLE} TypeScript API — Versions</title>
205+
<meta name="viewport" content="width=device-width,initial-scale=1">
206+
<link rel="canonical" href="${BASE}/${FRAMEWORK}/">
207+
<style>body{font-family:system-ui,-apple-system,sans-serif;max-width:56em;margin:0 auto;padding:2em;line-height:1.6;color:#1a1a2e}a{color:#0366d6;text-decoration:none}a:hover{text-decoration:underline}h1{border-bottom:2px solid #e1e4e8;padding-bottom:0.3em}table{border-collapse:collapse;width:100%}th,td{text-align:left;padding:0.5em 1em;border-bottom:1px solid #e1e4e8}th{background:#f6f8fa}nav{font-size:0.9em;margin-bottom:1.5em}</style>
208+
</head><body>
209+
<nav><a href="../">← All Frameworks</a></nav>
210+
<h1>${TITLE} TypeScript API</h1>
211+
<p>Package: <code>${PKG}</code></p>
212+
<table><thead><tr><th>Version</th><th>Release Line</th></tr></thead><tbody>${ROWS}</tbody></table>
213+
</body></html>
214+
EOF
215+
done
216+
217+
# Close main index
218+
echo "</body></html>" >> api/index.html
219+
154220
- name: Commit and push to gh-pages
155221
working-directory: gh-pages
156222
run: |

0 commit comments

Comments
 (0)