diff --git a/.changeset/seo-llm-discoverability.md b/.changeset/seo-llm-discoverability.md
new file mode 100644
index 00000000000..a845151cc84
--- /dev/null
+++ b/.changeset/seo-llm-discoverability.md
@@ -0,0 +1,2 @@
+---
+---
diff --git a/.github/workflows/generate-api-docs.yml b/.github/workflows/generate-api-docs.yml
index 0e2c5f97c2d..1a0057e1e79 100644
--- a/.github/workflows/generate-api-docs.yml
+++ b/.github/workflows/generate-api-docs.yml
@@ -60,7 +60,7 @@ jobs:
for OVERVIEW_URL in "https://sdk.openui5.org/versionoverview.json" "https://ui5.sap.com/versionoverview.json"; do
# Get LTS versions + the latest (highest) maintenance version
- # Filter: lts===true OR highest minor. Hard floor: minor >= 120.
+ # Filter: lts===true OR highest minor. Floor: types packages exist since 1.120.
MAINT_LINES=$(curl -sf "$OVERVIEW_URL" | node -e "
const data = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
const maintained = data.versions.filter(v => v.support === 'Maintenance');
@@ -68,15 +68,19 @@ jobs:
const lines = maintained
.filter(v => v.lts === true || v === latest)
.map(v => v.version.replace('.*',''))
- .filter(v => parseInt(v.split('.')[1]) >= 120);
+ .filter(v => {
+ const [maj, min] = v.split('.').map(Number);
+ return maj >= 2 || (maj === 1 && min >= 120);
+ });
console.log(lines.join(' '));
")
PKG=$( [[ "$OVERVIEW_URL" == *"openui5"* ]] && echo "@openui5/types" || echo "@sapui5/types" )
for LINE in $MAINT_LINES; do
- # Get the latest published patch for this minor line
- LATEST=$(npm show "${PKG}@~${LINE}.0" version 2>/dev/null | tail -1)
+ # Get the latest published patch for this minor line.
+ # npm show with a range outputs "pkg@ver 'ver'" per match; extract the bare version.
+ LATEST=$(npm show "${PKG}@~${LINE}.0" version 2>/dev/null | tail -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | tail -1)
if [ -n "$LATEST" ]; then
VERSIONS="${VERSIONS}${VERSIONS:+,}${PKG}@${LATEST}"
fi
@@ -154,77 +158,17 @@ jobs:
- name: Update index pages
working-directory: gh-pages
run: |
- BASE="https://ui5.github.io/typescript/api"
-
- # Start building api/index.html
- cat > api/index.html << 'EOF'
-
-
-
- UI5 TypeScript API Reference
-
-
-
-
-
-
- UI5 TypeScript API Reference
- Generated from @openui5/types and @sapui5/types type definitions.
- EOF
-
- for FRAMEWORK in openui5 sapui5; do
- [ -d "api/${FRAMEWORK}" ] || continue
- TITLE=$( [[ "$FRAMEWORK" == "openui5" ]] && echo "OpenUI5" || echo "SAPUI5" )
- PKG=$( [[ "$FRAMEWORK" == "openui5" ]] && echo "@openui5/types" || echo "@sapui5/types" )
-
- # Collect versions (directories containing a .version file), sorted newest first
- ROWS_MAIN=""
- ROWS_FW=""
- for VDIR in $(find "api/${FRAMEWORK}" -maxdepth 1 -mindepth 1 -type d | sort -t. -k2 -rn); do
- DIR_NAME=$(basename "$VDIR")
- if [ -f "${VDIR}/.version" ]; then
- FULL_VER=$(cat "${VDIR}/.version")
- ROWS_MAIN="${ROWS_MAIN}| ${FULL_VER} | ${DIR_NAME} |
"
- ROWS_FW="${ROWS_FW}| ${FULL_VER} | ${DIR_NAME} |
"
- fi
- done
-
- [ -z "$ROWS_MAIN" ] && continue
-
- # Append framework section to main index
- cat >> api/index.html << EOF
- ${TITLE}
- Package: ${PKG}
-
- EOF
-
- # Create framework-specific index
- cat > "api/${FRAMEWORK}/index.html" << EOF
-
-
-
- ${TITLE} TypeScript API — Versions
-
-
-
-
-
- ${TITLE} TypeScript API
- Package: ${PKG}
-
-
- EOF
- done
-
- # Close main index
- echo "" >> api/index.html
+ node ../main/scripts/generate-api-docs/generate-index-pages.mjs \
+ --api-dir api \
+ --site-root . \
+ --base-url https://ui5.github.io/typescript/api
- name: Commit and push to gh-pages
working-directory: gh-pages
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- git add api/
+ git add api/ sitemap.xml
if git diff --cached --quiet; then
echo "No changes to commit"
else
diff --git a/scripts/generate-api-docs/generate-index-pages.mjs b/scripts/generate-api-docs/generate-index-pages.mjs
new file mode 100644
index 00000000000..4d442d53806
--- /dev/null
+++ b/scripts/generate-api-docs/generate-index-pages.mjs
@@ -0,0 +1,241 @@
+#!/usr/bin/env node
+/**
+ * Generates index pages, sitemap index, and llms.txt for the API documentation site.
+ *
+ * This script runs after per-version docs have been generated. It scans the api/
+ * directory for version folders (identified by a .version marker file) and produces:
+ * - api/index.html — main landing page listing all frameworks and versions
+ * - api/{framework}/index.html — per-framework version list
+ * - sitemap.xml — sitemap index referencing all per-version sitemaps
+ * - api/llms.txt — LLM-friendly structured overview
+ *
+ * Usage:
+ * node generate-index-pages.mjs --api-dir --site-root --base-url
+ *
+ * Example (from workflow):
+ * node generate-index-pages.mjs --api-dir api --site-root . --base-url https://ui5.github.io/typescript/api
+ */
+
+import { readdirSync, readFileSync, writeFileSync, existsSync, statSync } from "fs";
+import { join } from "path";
+
+// --- Argument parsing ---
+
+const args = process.argv.slice(2);
+function getArg(name) {
+ const idx = args.indexOf(`--${name}`);
+ return idx >= 0 ? args[idx + 1] : undefined;
+}
+
+const API_DIR = getArg("api-dir");
+const SITE_ROOT = getArg("site-root");
+const BASE_URL = (getArg("base-url") || "").replace(/\/+$/, ""); // strip trailing slashes
+
+if (!API_DIR || !SITE_ROOT || !BASE_URL) {
+ console.error("Usage: generate-index-pages.mjs --api-dir --site-root --base-url ");
+ process.exit(1);
+}
+
+// Derive the site-level URL from the base-url (strip trailing /api or /api/)
+const SITE_URL = BASE_URL.replace(/\/api\/?$/, "");
+
+// --- Framework definitions ---
+
+const FRAMEWORKS = [
+ { id: "openui5", title: "OpenUI5", pkg: "@openui5/types" },
+ { id: "sapui5", title: "SAPUI5", pkg: "@sapui5/types" },
+];
+
+// Key libraries to highlight in llms.txt (from OpenUI5)
+const KEY_LIBRARIES = [
+ { id: "sap.m", desc: "Main UI controls — Button, Input, List, Table, Dialog, MessageBox" },
+ { id: "sap.ui.core", desc: "Core framework — Control, Element, Component, Model, routing" },
+ { id: "sap.f", desc: "SAP Fiori controls — FlexibleColumnLayout, ShellBar, DynamicPage" },
+ { id: "sap.ui.table", desc: "Analytical and tree tables" },
+ { id: "sap.ui.layout", desc: "Layout controls — Grid, Splitter, ResponsiveFlowLayout" },
+ { id: "sap.uxap", desc: "Object Page pattern" },
+ { id: "sap.ui.integration", desc: "Integration Cards" },
+ { id: "sap.tnt", desc: "Tool Page, InfoLabel, SideNavigation" },
+];
+
+// --- Helpers ---
+
+function escapeHtml(str) {
+ return str.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """);
+}
+
+/**
+ * Scan a framework directory for version subdirectories containing a .version marker.
+ * Returns sorted array (newest first) of { dir, minor, fullVersion }.
+ */
+function getVersions(frameworkDir) {
+ if (!existsSync(frameworkDir)) return [];
+
+ return readdirSync(frameworkDir)
+ .filter((d) => {
+ const full = join(frameworkDir, d);
+ return statSync(full).isDirectory() && existsSync(join(full, ".version"));
+ })
+ .map((d) => ({
+ dir: d,
+ minor: d,
+ fullVersion: readFileSync(join(frameworkDir, d, ".version"), "utf8").trim(),
+ }))
+ .sort((a, b) => {
+ // Sort by major.minor descending (e.g. 2.1 > 1.149 > 1.136)
+ const [aMaj, aMin] = a.minor.split(".").map(Number);
+ const [bMaj, bMin] = b.minor.split(".").map(Number);
+ return bMaj - aMaj || bMin - aMin;
+ });
+}
+
+// --- CSS (shared with generate.mjs — index page style) ---
+
+const CSS = `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}`;
+
+function htmlPage({ title, description, canonicalUrl, nav, content }) {
+ return `
+
+
+${escapeHtml(title)}
+
+
+
+
+
+
+
+
+
+
+
+${content}
+
+`;
+}
+
+function versionTable(versions, hrefPrefix) {
+ const rows = versions
+ .map((v) => `| ${v.fullVersion} | ${v.minor} |
`)
+ .join("");
+ return ``;
+}
+
+// --- Generate pages ---
+
+console.log("Generating index pages...");
+
+// Collect all framework data
+const frameworkData = FRAMEWORKS.map((fw) => ({
+ ...fw,
+ versions: getVersions(join(API_DIR, fw.id)),
+})).filter((fw) => fw.versions.length > 0);
+
+// 1. Main index: api/index.html
+const mainSections = frameworkData
+ .map(
+ (fw) => `${fw.title}
+Package: ${fw.pkg}
+${versionTable(fw.versions, `${fw.id}/`)}`
+ )
+ .join("\n");
+
+writeFileSync(
+ join(API_DIR, "index.html"),
+ htmlPage({
+ title: "UI5 TypeScript API Reference",
+ description: "Crawlable TypeScript API documentation for OpenUI5 and SAPUI5",
+ canonicalUrl: `${BASE_URL}/`,
+ nav: `← UI5 & TypeScript`,
+ content: `UI5 TypeScript API Reference
+Generated from @openui5/types and @sapui5/types type definitions.
+${mainSections}`,
+ })
+);
+console.log(" api/index.html");
+
+// 2. Per-framework index: api/{framework}/index.html
+for (const fw of frameworkData) {
+ writeFileSync(
+ join(API_DIR, fw.id, "index.html"),
+ htmlPage({
+ title: `${fw.title} TypeScript API — Versions`,
+ description: `${fw.title} TypeScript API — available versions of ${fw.pkg} type definitions`,
+ canonicalUrl: `${BASE_URL}/${fw.id}/`,
+ nav: `← All Frameworks`,
+ content: `${fw.title} TypeScript API
+Package: ${fw.pkg}
+${versionTable(fw.versions, "")}`,
+ })
+ );
+ console.log(` api/${fw.id}/index.html`);
+}
+
+// 3. Sitemap index: sitemap.xml (at site root)
+const sitemapRefs = [];
+
+// Include the static site sitemap if it exists
+const siteSitemapPath = join(SITE_ROOT, "sitemap-site.xml");
+if (existsSync(siteSitemapPath)) {
+ sitemapRefs.push(`${SITE_URL}/sitemap-site.xml`);
+}
+
+// Include all per-version sitemaps
+for (const fw of frameworkData) {
+ for (const v of fw.versions) {
+ const sitemapPath = join(API_DIR, fw.id, v.dir, "sitemap.xml");
+ if (existsSync(sitemapPath)) {
+ sitemapRefs.push(`${BASE_URL}/${fw.id}/${v.dir}/sitemap.xml`);
+ }
+ }
+}
+
+const sitemapIndex = `
+
+${sitemapRefs.map((url) => ` ${url}`).join("\n")}
+
+`;
+
+writeFileSync(join(SITE_ROOT, "sitemap.xml"), sitemapIndex);
+console.log(` sitemap.xml (${sitemapRefs.length} sitemaps)`);
+
+// 4. LLM-friendly overview: api/llms.txt
+const latestOpenUI5 = frameworkData.find((fw) => fw.id === "openui5")?.versions[0];
+
+let llmsTxt = `# UI5 TypeScript API Reference
+
+> Complete TypeScript API documentation for the OpenUI5 and SAPUI5 UI frameworks, generated from @openui5/types and @sapui5/types npm packages.
+
+Each class page includes the TypeScript import statement, inheritance hierarchy, constructor signatures, properties, methods, events, and associations. All content is static HTML — no JavaScript required for reading.
+
+## Versions
+`;
+
+for (const fw of frameworkData) {
+ llmsTxt += `\n### ${fw.title}\n`;
+ for (const v of fw.versions) {
+ llmsTxt += `- [${fw.title} ${v.minor}](${BASE_URL}/${fw.id}/${v.dir}/index.html): ${v.fullVersion}\n`;
+ }
+}
+
+if (latestOpenUI5) {
+ const latestDir = latestOpenUI5.dir;
+ llmsTxt += `\n## Key Libraries (OpenUI5 ${latestDir})\n\n`;
+ for (const lib of KEY_LIBRARIES) {
+ llmsTxt += `- [${lib.id}](${BASE_URL}/openui5/${latestDir}/${lib.id}/README.html): ${lib.desc}\n`;
+ }
+}
+
+llmsTxt += `
+## Resources
+
+- [Sitemap Index](${SITE_URL}/sitemap.xml): Machine-readable index of all per-version sitemaps
+- [UI5 & TypeScript Guide](${SITE_URL}/): Getting started, FAQ, release notes
+- [npm: @openui5/types](https://www.npmjs.com/package/@openui5/types): OpenUI5 type definitions package
+- [npm: @sapui5/types](https://www.npmjs.com/package/@sapui5/types): SAPUI5 type definitions package
+`;
+
+writeFileSync(join(API_DIR, "llms.txt"), llmsTxt);
+console.log(" api/llms.txt");
+
+console.log("\nDone.");
diff --git a/scripts/generate-api-docs/generate.mjs b/scripts/generate-api-docs/generate.mjs
index 53d4b9d1ab5..505f453ad66 100644
--- a/scripts/generate-api-docs/generate.mjs
+++ b/scripts/generate-api-docs/generate.mjs
@@ -103,15 +103,26 @@ let totalReplacements = 0;
// Maps module path → default export name, e.g. "sap/m/Button" → "Button", "sap/ui/core/Element" → "UI5Element"
const defaultExports = new Map();
+// Also collect which module paths are declared in each library file.
+// This is used later to exclude cross-library re-exports from the output.
+// Maps library name (e.g. "sap.f") → Set of module paths declared in that .d.ts
+const libraryModules = new Map();
+
for (const file of dtsFiles) {
const filePath = join(TYPES_DIR, file);
const content = readFileSync(filePath, "utf8");
+ // Track which modules are declared in this library file (e.g. "sap.f.d.ts" → "sap.f")
+ const libName = file.replace(/\.d\.ts$/, ""); // e.g. "sap.f"
+ if (!libraryModules.has(libName)) libraryModules.set(libName, new Set());
+ const libModules = libraryModules.get(libName);
+
// Find: declare module "sap/m/Button" { ... export default class Button
const moduleRegex = /^declare module "([^"]+)"/gm;
let moduleMatch;
while ((moduleMatch = moduleRegex.exec(content)) !== null) {
const moduleName = moduleMatch[1];
+ libModules.add(moduleName);
const moduleStart = moduleMatch.index;
// Find the next declare module to bound our search
const nextModule = content.indexOf("\ndeclare module ", moduleStart + 1);
@@ -330,14 +341,21 @@ footer{margin-top:3em;padding-top:1em;border-top:1px solid #e1e4e8;font-size:0.8
.kw{color:#d73a49}.tp{color:#6f42c1}.fn{color:#6f42c1}.str{color:#032f62}.cm{color:#6a737d}`;
function htmlTemplate(title, breadcrumb, content, canonicalUrl) {
+ const fullTitle = escapeHtml(`${title} — ${frameworkName} TypeScript API`);
+ const description = escapeHtml(`${title} — ${frameworkName} TypeScript API Reference (${actualVersion})`);
return `
-${escapeHtml(title)} — ${frameworkName} TypeScript API
-
+${fullTitle}
+
${canonicalUrl ? `` : ""}
+
+
+
+${canonicalUrl ? `` : ""}
+
@@ -358,11 +376,61 @@ let skippedCount = 0;
// Directories/files to exclude from output (not UI5-specific)
const EXCLUDE_PATTERNS = ["interfaces/JQuery", "interfaces/JQuery.", "/JQueryStatic", "JQueryPromise"];
+// Precompute namespace prefixes for all libraries (used to detect augmentations)
+// e.g. "sap.f" → "sap/f/", "sap.ui.core" → "sap/ui/core/"
+const libNamespacePrefixes = new Map();
+for (const lib of libraryModules.keys()) {
+ libNamespacePrefixes.set(lib, lib.replace(/\./g, "/") + "/");
+}
+
function shouldExclude(relPath) {
// Exclude jQuery-related pages
if (EXCLUDE_PATTERNS.some((p) => relPath.includes(p))) return true;
// Exclude residual "default.html" pages (from un-renamed default exports)
if (relPath.endsWith("/default.html")) return true;
+ // Exclude cross-library re-exports.
+ // TypeDoc merges all .d.ts files into one documentation set, so the shared "sap" namespace
+ // causes content from other libraries to appear under each library's directory.
+ // We exclude a page if:
+ // (a) it doesn't match any module declared in the library's own .d.ts, OR
+ // (b) the module it matches belongs to another library's namespace (an augmentation).
+ // For example, sap.f.d.ts augments "sap/tnt/library" — but sap.tnt owns that namespace,
+ // so we exclude it from sap.f's output. Meanwhile sap.ui.core.d.ts declares "sap/base/Log"
+ // which no other library owns, so it stays.
+ const libMatch = relPath.match(/^(sap\.[^/]+)\//);
+ if (libMatch) {
+ const lib = libMatch[1]; // e.g. "sap.f"
+ const afterLib = relPath.slice(lib.length + 1); // path after "sap.f/"
+ // Always keep the library's own README (the module index page)
+ if (afterLib === "README.html") return false;
+ // Check against the definitive module list for this library
+ const modules = libraryModules.get(lib);
+ if (modules && modules.size > 0) {
+ // Derive the module path from afterLib by trying successive directory prefixes.
+ // E.g. "sap/f/Avatar/classes/Avatar.html" → try "sap/f/Avatar/classes/Avatar",
+ // "sap/f/Avatar/classes", "sap/f/Avatar" until a Set.has() hit (O(1) per check).
+ let matchingModule;
+ const stripped = afterLib.replace(/\.html$/, "");
+ let candidate = stripped;
+ while (candidate) {
+ if (modules.has(candidate)) {
+ matchingModule = candidate;
+ break;
+ }
+ const lastSlash = candidate.lastIndexOf("/");
+ if (lastSlash < 0) break;
+ candidate = candidate.slice(0, lastSlash);
+ }
+ if (!matchingModule) return true; // not declared in this library's .d.ts — exclude
+ // Check if another library owns this module's namespace (= augmentation)
+ const moduleNs = matchingModule + "/"; // e.g. "sap/tnt/library/"
+ for (const [otherLib, otherNs] of libNamespacePrefixes) {
+ if (otherLib !== lib && moduleNs.startsWith(otherNs)) {
+ return true;
+ }
+ }
+ }
+ }
return false;
}
@@ -459,6 +527,7 @@ console.log(` Rendered ${fileCount} HTML files (skipped ${skippedCount} jQuery-
// --- Step 5: Generate sitemap ---
console.log("\nStep 5: Generating sitemap...");
const sitemapEntries = [];
+const today = new Date().toISOString().slice(0, 10);
function collectUrls(dir) {
for (const entry of readdirSync(dir)) {
@@ -477,7 +546,7 @@ collectUrls(OUT_DIR);
const sitemap = `
-${sitemapEntries.map((url) => ` ${url}`).join("\n")}
+${sitemapEntries.map((url) => ` ${url}${today}`).join("\n")}
`;
writeFileSync(join(OUT_DIR, "sitemap.xml"), sitemap);