Skip to content

Commit 5f5ee05

Browse files
authored
chore(docs): migrate documentation to DevHub with GH Pages redirects (#382)
* chore(docs): migrate doc links to DevHub and add GH Pages redirects Point all documentation links to https://www.databricks.com/devhub/docs/appkit/v0/. Add a custom Docusaurus postBuild plugin that replaces all generated HTML with redirect pages pointing to DevHub, while preserving llms.txt, .md files, and JSON schemas for npm packaging and IDE validation. Schema $schema/$id URLs remain on GitHub Pages (databricks.github.io/appkit/schemas/). Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com> * fix(docs): keep llms.txt and schema URLs on GitHub Pages llms.txt is a static file still served from GH Pages (redirect plugin only replaces HTML). Schemas are also hosted on GH Pages, not devhub. Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com> * fix(docs): move redirect to post-build script to fix llms.txt The Docusaurus postBuild hooks run in parallel, causing the redirect plugin to corrupt llms.txt and .md files by replacing HTML before the llms-txt plugin extracts content. Move redirect logic to a standalone script that runs after docusaurus build completes. Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com> --------- Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
1 parent ff1fc7b commit 5f5ee05

8 files changed

Lines changed: 108 additions & 20 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ AppKit's power comes from its plugin system. Each plugin adds a focused capabili
2727
2828
## Getting started
2929

30-
Follow the [Getting Started](https://databricks.github.io/appkit/docs/) guide to get started with AppKit.
30+
Follow the [Getting Started](https://www.databricks.com/devhub/docs/appkit/v0/) guide to get started with AppKit.
3131

32-
🤖 For AI/code assistants, see the [AI-assisted development](https://databricks.github.io/appkit/docs/development/ai-assisted-development) guide.
32+
🤖 For AI/code assistants, see the [AI-assisted development](https://www.databricks.com/devhub/docs/appkit/v0/development/ai-assisted-development) guide.
3333

3434
## Documentation
3535

36-
📖 For full AppKit documentation, visit the [AppKit Documentation](https://databricks.github.io/appkit/) website.
36+
📖 For full AppKit documentation, visit the [AppKit Documentation](https://www.databricks.com/devhub/docs/appkit/v0/) website.
3737

3838
## Contributing
3939

docs/README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,10 @@ This command generates static content into the `build` directory and can be serv
3030

3131
## Deployment
3232

33-
Using SSH:
33+
Documentation is published on [DevHub](https://www.databricks.com/devhub/docs/appkit/v0/). GitHub Pages (`databricks.github.io/appkit/`) automatically redirects all existing URLs to DevHub via `.github/workflows/docs-deploy.yml`.
3434

35-
```bash
36-
USE_SSH=true pnpm deploy
37-
```
38-
39-
Not using SSH:
40-
41-
```bash
42-
GIT_USER=<Your GitHub username> pnpm deploy
43-
```
35+
The `pnpm build` command:
36+
1. Runs `docusaurus build` — generates HTML, `llms.txt`, and `.md` files
37+
2. Runs `apply-redirects` — replaces HTML pages with redirect pages pointing to DevHub
4438

45-
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
39+
Static files remain served from GitHub Pages: JSON schemas (`/schemas/`), `llms.txt`, and `.md` files (used by `npx @databricks/appkit docs` for npm-bundled documentation).

docs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"scripts": {
66
"docusaurus": "docusaurus",
77
"dev": "pnpm run gen && docusaurus start --no-open",
8-
"build": "pnpm run gen && docusaurus build",
8+
"build": "pnpm run gen && docusaurus build && pnpm run apply-redirects",
9+
"apply-redirects": "tsx scripts/apply-redirects.ts",
910
"gen": "pnpm run build-appkit-ui-styles && pnpm run generate-component-docs && pnpm run copy-schemas",
1011
"build-appkit-ui-styles": "tsx scripts/build-appkit-ui-styles.ts",
1112
"copy-schemas": "tsx scripts/copy-schemas.ts",

docs/scripts/apply-redirects.ts

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/**
2+
* Replaces all generated HTML pages with redirect pages pointing to DevHub.
3+
* Run AFTER `docusaurus build` so that llms.txt and .md files are generated
4+
* from the original HTML content first.
5+
*
6+
* Static files (schemas, llms.txt, .md) are left untouched.
7+
*/
8+
9+
import { existsSync, readdirSync, statSync, writeFileSync } from "node:fs";
10+
import { dirname, join } from "node:path";
11+
import { fileURLToPath } from "node:url";
12+
13+
const __dirname = dirname(fileURLToPath(import.meta.url));
14+
const BUILD_DIR = join(__dirname, "../build");
15+
const DEVHUB_BASE = "https://www.databricks.com/devhub/docs/appkit/v0";
16+
17+
function generateRedirectHtml(targetUrl: string): string {
18+
return `<!DOCTYPE html>
19+
<html lang="en">
20+
<head>
21+
<meta charset="utf-8" />
22+
<title>Redirecting&hellip;</title>
23+
<link rel="canonical" href="${targetUrl}" />
24+
<meta http-equiv="refresh" content="0; url=${targetUrl}" />
25+
</head>
26+
<body>
27+
<p>This page has moved. Redirecting to <a href="${targetUrl}">${targetUrl}</a>&hellip;</p>
28+
</body>
29+
</html>`;
30+
}
31+
32+
function findHtmlFiles(dir: string): string[] {
33+
const results: string[] = [];
34+
for (const entry of readdirSync(dir)) {
35+
const fullPath = join(dir, entry);
36+
if (statSync(fullPath).isDirectory()) {
37+
results.push(...findHtmlFiles(fullPath));
38+
} else if (entry === "index.html") {
39+
results.push(fullPath);
40+
}
41+
}
42+
return results;
43+
}
44+
45+
if (!existsSync(BUILD_DIR)) {
46+
console.error(`Build directory not found: ${BUILD_DIR}`);
47+
console.error("Run 'docusaurus build' first.");
48+
process.exit(1);
49+
}
50+
51+
console.log("Applying DevHub redirects to HTML pages...");
52+
53+
const htmlFiles = findHtmlFiles(BUILD_DIR);
54+
let count = 0;
55+
56+
for (const htmlPath of htmlFiles) {
57+
// Get path relative to build dir, e.g. "/docs/plugins/lakebase"
58+
const relativePath = htmlPath
59+
.slice(BUILD_DIR.length)
60+
.replace(/\/index\.html$/, "");
61+
62+
// Map /docs/{path} → devhub /{path} (devhub flattens the /docs/ prefix)
63+
const pathWithoutDocs = relativePath.replace(/^\/docs\/?/, "/");
64+
const devhubUrl = `${DEVHUB_BASE}${pathWithoutDocs || "/"}`;
65+
66+
writeFileSync(htmlPath, generateRedirectHtml(devhubUrl));
67+
count++;
68+
}
69+
70+
// Catch-all 404.html for paths not matching a generated route
71+
const notFoundHtml = `<!DOCTYPE html>
72+
<html lang="en">
73+
<head>
74+
<meta charset="utf-8" />
75+
<title>Redirecting&hellip;</title>
76+
<script>
77+
(function() {
78+
var path = window.location.pathname.replace(/^\\/appkit\\/?/, '/');
79+
path = path.replace(/^\\/docs\\/?/, '/');
80+
var target = "${DEVHUB_BASE}" + path + window.location.search + window.location.hash;
81+
window.location.replace(target);
82+
})();
83+
</script>
84+
</head>
85+
<body>
86+
<p>Redirecting to <a href="${DEVHUB_BASE}/">AppKit Documentation</a>&hellip;</p>
87+
</body>
88+
</html>`;
89+
writeFileSync(join(BUILD_DIR, "404.html"), notFoundHtml);
90+
91+
console.log(`Done! Replaced ${count} HTML page(s) with redirects.`);

packages/appkit/src/registry/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export { ResourceRegistry } from "./resource-registry";
1717
export * from "./types";
1818

1919
/**
20-
* URL to the plugin manifest JSON Schema hosted on GitHub Pages.
20+
* URL to the plugin manifest JSON Schema.
2121
* Can be used for validation or referenced in manifest files.
2222
*
2323
* @example
@@ -28,6 +28,8 @@ export * from "./types";
2828
* ...
2929
* }
3030
* ```
31+
*
32+
* @see {@link https://www.databricks.com/devhub/docs/appkit/v0/ | AppKit Documentation}
3133
*/
3234
// TODO: We may want to open a PR to https://github.com/SchemaStore/schemastore
3335
// export const MANIFEST_SCHEMA_ID =

template/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# {{.projectName}}
22

3-
A Databricks App powered by [AppKit](https://databricks.github.io/appkit/), featuring React, TypeScript, and Tailwind CSS.
3+
A Databricks App powered by [AppKit](https://www.databricks.com/devhub/docs/appkit/v0/), featuring React, TypeScript, and Tailwind CSS.
44

55
**Enabled plugins:**
66
{{- if .plugins.analytics}}
@@ -41,7 +41,7 @@ DATABRICKS_APP_PORT=8000
4141

4242
#### Lakebase Configuration
4343

44-
The Lakebase plugin requires additional environment variables for PostgreSQL connectivity. To learn how to configure the Lakebase plugin, see the [Lakebase plugin documentation](https://databricks.github.io/appkit/docs/plugins/lakebase).
44+
The Lakebase plugin requires additional environment variables for PostgreSQL connectivity. To learn how to configure the Lakebase plugin, see the [Lakebase plugin documentation](https://www.databricks.com/devhub/docs/appkit/v0/plugins/lakebase).
4545
{{- end}}
4646

4747
### CLI Authentication

template/client/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function HomePage() {
164164
</li>
165165
<li>
166166
<a
167-
href="https://databricks.github.io/appkit/"
167+
href="https://www.databricks.com/devhub/docs/appkit/v0/"
168168
target="_blank"
169169
rel="noopener noreferrer"
170170
className="text-primary underline underline-offset-4 hover:text-primary/80"

template/server/routes/lakebase/todo-routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function setupSampleLakebaseRoutes(appkit: AppKitWithLakebase) {
4545
} catch (err) {
4646
console.warn('[lakebase] Database setup failed:', (err as Error).message);
4747
console.warn('[lakebase] Routes will be registered but may return errors');
48-
console.warn('[lakebase] See https://databricks.github.io/appkit/docs/plugins/lakebase#database-permissions for troubleshooting');
48+
console.warn('[lakebase] See https://www.databricks.com/devhub/docs/appkit/v0/plugins/lakebase#database-permissions for troubleshooting');
4949
}
5050

5151
appkit.server.extend((app) => {

0 commit comments

Comments
 (0)