Skip to content

Commit 950bdb8

Browse files
committed
Update url docs
1 parent 431c9ab commit 950bdb8

5 files changed

Lines changed: 26 additions & 22 deletions

File tree

‎vix-site/src/App.vue‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import { useHead } from "@unhead/vue";
55
import SiteHeader from "./components/layout/SiteHeader.vue";
66
import SiteFooter from "./components/layout/SiteFooter.vue";
77
import { findBlogPost } from "./data/blog";
8-
import { findDocsPage } from "./data/docs";
98
109
const route = useRoute();
1110
const meta = computed(() => {
1211
const post =
1312
route.path.startsWith("/blog/") && findBlogPost(route.params.pathMatch);
14-
const doc = route.path.startsWith("/docs") && findDocsPage(route.params.pathMatch);
1513
const pages = {
1614
"/": [
1715
"Vix.cpp | A runtime for C++ applications",
@@ -29,15 +27,9 @@ const meta = computed(() => {
2927
"Blog | Vix.cpp",
3028
"News, release notes, technical deep dives, and development updates from Vix.cpp.",
3129
],
32-
"/docs": [
33-
"Documentation | Vix.cpp",
34-
"Vix.cpp documentation for building native C++ applications.",
35-
],
3630
};
3731
const [title, description] = post
3832
? [`${post.title} | Vix.cpp`, post.description]
39-
: doc
40-
? [`${doc.title} | Vix.cpp`, `Vix.cpp documentation: ${doc.title}.`]
4133
: pages[route.path] || ["Vix.cpp", ""];
4234
const path = post ? `/blog/${post.path}` : route.path;
4335
const url = `https://vixcpp.com${path === "/" ? "/" : path}`;

‎vix-site/src/main.js‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ViteSSG } from "vite-ssg";
33
import App from "./App.vue";
44
import { routes, routerOptions } from "./router";
55
import { blogPosts } from "./data/blog";
6-
import { docsPages } from "./data/docs";
76

87
import "./styles/tokens.css";
98
import "./styles/base.css";
@@ -23,7 +22,5 @@ export const includedRoutes = () => [
2322
"/learn",
2423
"/community",
2524
"/blog",
26-
"/docs",
2725
...blogPosts.map((post) => `/blog/${post.path}`),
28-
...docsPages.filter((page) => page.path).map((page) => `/docs/${page.path}`),
2926
];

‎vix-site/src/router/index.js‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,19 @@ export const routes = [
3737
name: "docs",
3838
beforeEnter: (to) => {
3939
const path = to.params.pathMatch;
40-
4140
const suffix = Array.isArray(path) ? path.join("/") : path || "";
42-
43-
window.location.href = `https://docs.vixcpp.com/${suffix}`;
41+
const target = new URL(
42+
suffix ? `/${suffix}` : "/",
43+
"https://docs.vixcpp.com",
44+
);
45+
const queryStart = to.fullPath.indexOf("?");
46+
const hashStart = to.fullPath.indexOf("#");
47+
target.search =
48+
queryStart === -1
49+
? ""
50+
: to.fullPath.slice(queryStart, hashStart === -1 ? undefined : hashStart);
51+
target.hash = to.hash;
52+
window.location.replace(target);
4453

4554
return false;
4655
},

‎vix-site/vercel.json‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
"outputDirectory": "dist",
44
"installCommand": "npm install",
55
"routes": [
6+
{
7+
"src": "/docs/?$",
8+
"status": 308,
9+
"headers": {
10+
"Location": "https://docs.vixcpp.com"
11+
}
12+
},
13+
{
14+
"src": "/docs/(.*)",
15+
"status": 308,
16+
"headers": {
17+
"Location": "https://docs.vixcpp.com/$1"
18+
}
19+
},
620
{
721
"handle": "filesystem"
822
},

‎vix-site/vite.config.js‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ export default defineConfig({
5959
};
6060
})
6161
.filter((post) => post.path);
62-
const docs = JSON.parse(
63-
readFileSync(
64-
fileURLToPath(new URL("./src/generated/docs-index.json", import.meta.url)),
65-
"utf8",
66-
),
67-
);
6862
const items = posts
6963
.map(
7064
(post) =>
@@ -81,9 +75,7 @@ export default defineConfig({
8175
"/learn",
8276
"/community",
8377
"/blog",
84-
"/docs",
8578
...allPosts.map((post) => `/blog/${post.path}`),
86-
...docs.filter((page) => page.path).map((page) => `/docs/${page.path}`),
8779
]
8880
.map(
8981
(path) =>

0 commit comments

Comments
 (0)