From 252b2ff0708c0db07630d032dba3ef4edf4d5938 Mon Sep 17 00:00:00 2001
From: Michael Dougall <6801309+itsdouges@users.noreply.github.com>
Date: Fri, 27 Sep 2024 15:59:08 +1000
Subject: [PATCH] Docs sitemap
adeira-source-id: fbd5ae6011161ed8a98610f795b83dd1fef3c3f2
---
apps/docs/package.json | 4 +
apps/docs/public/sitemap.xml | 206 ++++++++++++++++++++++++++
apps/docs/scripts/generate-sitemap.ts | 70 +++++++++
apps/docs/scripts/tsconfig.json | 23 +++
4 files changed, 303 insertions(+)
create mode 100644 apps/docs/public/sitemap.xml
create mode 100644 apps/docs/scripts/generate-sitemap.ts
create mode 100644 apps/docs/scripts/tsconfig.json
diff --git a/apps/docs/package.json b/apps/docs/package.json
index 30d5f860..33c039a4 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -6,6 +6,7 @@
"license": "GPL-3.0",
"scripts": {
"build": "NEXT_PUBLIC_URL=https://triplex-docs-$(git branch --show-current)-try-triplex.vercel.app next build",
+ "build:sitemap": "ts-node ./scripts/generate-sitemap.ts",
"dev": "NEXT_PUBLIC_URL=localhost:3000 next",
"typedef": "tsc"
},
@@ -28,5 +29,8 @@
"three": "^0.168.0",
"typescript": "^5.6.2",
"zustand": "^4.3.2"
+ },
+ "devDependencies": {
+ "readdirp": "^3.6.0"
}
}
diff --git a/apps/docs/public/sitemap.xml b/apps/docs/public/sitemap.xml
new file mode 100644
index 00000000..04cb0db2
--- /dev/null
+++ b/apps/docs/public/sitemap.xml
@@ -0,0 +1,206 @@
+
+
+ https://triplex.dev/download
+ 2024-01-15 10:30:42 +1100
+ yearly
+ 0.9
+
+
+ https://triplex.dev/
+ 2024-06-21 11:44:48 +1000
+ yearly
+ 1
+
+
+ https://triplex.dev/pricing
+ 2023-08-07 19:32:37 +1000
+ yearly
+ 0.5
+
+
+ https://triplex.dev/legal/privacy-policy
+ 2023-11-01 12:41:25 +1100
+ yearly
+ 0.5
+
+
+ https://triplex.dev/docs/faq
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/overview
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/supporting/component-outside-of-project-files
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/supporting/installing-dependencies
+ 2023-08-07 19:32:37 +1000
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/supporting/resolve-type-error-assets
+ 2023-11-02 09:11:34 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/supporting/saving-outside-cwd
+ 2023-12-23 18:33:40 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/setup/linux
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/setup/macos
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/setup/manual-setup
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/setup/overview
+ 2023-12-27 15:58:39 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/setup/windows
+ 2024-06-25 20:36:55 +1000
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/guides/common-gotchas
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/guides/component-controls
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/guides/glsl-support
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/guides/javascript-projects
+ 2024-01-18 09:34:02 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/guides/leva-controls
+ 2024-01-18 09:34:02 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/guides/provider-controls
+ 2024-02-13 08:50:33 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/get-started/declaring-props
+ 2024-06-25 20:36:55 +1000
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/get-started/settings
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/docs/get-started/user-interface
+ 2024-01-15 10:30:42 +1100
+ monthly
+ 0.5
+
+
+ https://triplex.dev/blog/threejs-halloween-challenge
+ 2023-10-13 11:15:38 +1100
+ weekly
+ 0.6
+
+
+ https://triplex.dev/blog/v0.56.0-live-editing-props
+ 2024-01-16 13:24:09 +1100
+ weekly
+ 0.6
+
+
+ https://triplex.dev/blog/v0.57.0-edit-children-elements
+ 2024-01-16 13:24:09 +1100
+ weekly
+ 0.6
+
+
+ https://triplex.dev/blog/v0.58.0-provider-component-ui
+ 2024-01-16 13:24:09 +1100
+ weekly
+ 0.6
+
+
+ https://triplex.dev/blog/v0.59.0-backend-stability
+ 2024-01-16 13:24:09 +1100
+ weekly
+ 0.6
+
+
+ https://triplex.dev/blog/v0.60.0-element-actions
+ 2024-01-16 13:24:09 +1100
+ weekly
+ 0.6
+
+
+ https://triplex.dev/blog/v0.61.0-drag-n-drop-file-tabs
+ 2024-01-16 13:24:09 +1100
+ weekly
+ 0.6
+
+
+ https://triplex.dev/blog/v0.62.0-the-one-with-linux
+ 2024-01-16 13:24:09 +1100
+ weekly
+ 0.6
+
+
+ https://triplex.dev/blog/v0.63.0-new-year-new-features
+ 2024-01-16 13:24:09 +1100
+ weekly
+ 0.6
+
+
+ https://triplex.dev/blog/v0.64.0-shared-buffer-array-canvas-frame
+ 2024-01-16 13:24:09 +1100
+ weekly
+ 0.6
+
+
diff --git a/apps/docs/scripts/generate-sitemap.ts b/apps/docs/scripts/generate-sitemap.ts
new file mode 100644
index 00000000..7a69f91a
--- /dev/null
+++ b/apps/docs/scripts/generate-sitemap.ts
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) Michael Dougall. All rights reserved.
+ *
+ * This source code is licensed under the GPL-3.0 license found in the LICENSE
+ * file in the root directory of this source tree.
+ */
+import { execSync } from "node:child_process";
+import { writeFile } from "node:fs/promises";
+import { join } from "node:path";
+import readdirp from "readdirp";
+
+const root = join(process.cwd(), "pages");
+const sitemapLoc = join(process.cwd(), "public", "sitemap.xml");
+
+function getLastModifiedDateTime(fullPath: string) {
+ const result = execSync(
+ `git log -1 --pretty="format:%ci" ${fullPath}`,
+ ).toString();
+ return result || undefined;
+}
+
+const changeHints = [
+ ["/blog", "weekly"],
+ ["/docs", "monthly"],
+] as const;
+
+const priorityHints = [
+ ["/blog/", 0.6],
+ ["/download", 0.9],
+] as const;
+
+async function main() {
+ const sitemap = [];
+
+ for await (const entry of readdirp(root)) {
+ if (entry.path.endsWith(".mdx")) {
+ const path = entry.path.replace(".mdx", "").replace("index", "");
+ const url = "https://triplex.dev/" + path;
+
+ sitemap.push({
+ changeFrequency:
+ changeHints.find(([hint]) => url.includes(hint))?.[1] ?? "yearly",
+ lastModified: getLastModifiedDateTime(entry.fullPath),
+ priority: path
+ ? priorityHints.find(([hint]) => url.includes(hint))?.[1] ?? 0.5
+ : // Root gets immediate 1 priority.
+ 1,
+ url,
+ });
+ }
+ }
+
+ const xml = `
+ ${sitemap
+ .map((url) => {
+ return `
+ ${url.url}
+ ${url.lastModified}
+ ${url.changeFrequency}
+ ${url.priority}
+ `;
+ })
+ .join("\n ")}
+
+`;
+
+ await writeFile(sitemapLoc, xml);
+}
+
+main();
diff --git a/apps/docs/scripts/tsconfig.json b/apps/docs/scripts/tsconfig.json
new file mode 100644
index 00000000..3337bc59
--- /dev/null
+++ b/apps/docs/scripts/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "baseUrl": ".",
+ "esModuleInterop": true,
+ "forceConsistentCasingInFileNames": true,
+ "isolatedModules": true,
+ "moduleResolution": "node",
+ "skipLibCheck": true,
+ "strict": true,
+ "jsx": "preserve",
+ "allowJs": true,
+ "noEmit": true,
+ "incremental": true,
+ "module": "CommonJS",
+ "resolveJsonModule": true,
+ "types": ["@react-three/fiber"]
+ },
+ "ts-node": {
+ "transpileOnly": true,
+ "swc": true
+ },
+ "include": ["."]
+}