Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(website-docs): serve everything but the homepage from /docs/

wizardchencee697920e0a
diff --git a/website-docs/.vitepress/theme/SiteHeader.vue b/website-docs/.vitepress/theme/SiteHeader.vue
index 37029985b..816dae654 100644
--- a/website-docs/.vitepress/theme/SiteHeader.vue
+++ b/website-docs/.vitepress/theme/SiteHeader.vue
@@ -2,7 +2,7 @@
import { computed, h, ref, watch, onMounted, onUnmounted } from 'vue'
import { useData, useRoute } from 'vitepress'
import Search from 'vitepress/dist/client/theme-default/components/VPNavBarSearch.vue'
-import { repositoryUrl, headerIcons } from '../../shared/header'
+import { repositoryUrl, headerIcons, homeAssets } from '../../shared/header'
const { isDark } = useData()
const route = useRoute()
const docsNavigation = [
@@ -29,7 +29,7 @@ onUnmounted(() => document.removeEventListener('keydown', closeMenu))
<template>
<header class="wk-header wk-docs-header">
<div class="wk-header-inner">
- <a class="wk-brand" href="/" target="_self" aria-label="WeKnora 首页"><span class="wk-logo"><img :src="'/brand/weknora-original.png'" alt="WeKnora" width="945" height="650"></span></a>
+ <a class="wk-brand" href="/" target="_self" aria-label="WeKnora 首页"><span class="wk-logo"><img :src="`${homeAssets}/brand/weknora-original.png`" alt="WeKnora" width="945" height="650"></span></a>
<nav id="main-navigation" class="wk-navigation" :class="{ 'is-open': open }" aria-label="文档导航">
<a v-for="item in docsNavigation" :key="item.href" :href="item.href" :aria-current="route.path.startsWith(item.section) ? 'page' : undefined" @click="open = false">{{ item.label }}</a>
<div class="wk-header-search"><Search /></div>
diff --git a/website-docs/README.md b/website-docs/README.md
index ebf7d4c7a..c1b27d79f 100644
--- a/website-docs/README.md
+++ b/website-docs/README.md
@@ -8,6 +8,8 @@
- `/docs/`:直接进入“快速上手”。
- `/docs/…`:完整文档,保留分类导航、搜索和侧栏。
+站点只占用这两个路径:根目录下只有 `index.html`、`404.html` 和 `docs/`。官网的脚本、样式和图片都放在 `/docs/_home/` 下,所以上游网关只需转发 `/`(精确匹配)和 `/docs/` 前缀。`build` 会拒绝引用这两个路径以外资源的页面。
+
顶栏高 64px、横向铺满。两边使用 README 原版商标,共用颜色、字体和深浅色偏好;Logo 在当前标签返回官网。官网和文档各自使用适合当前页面的导航。
## 发布方式:静态文件 + Nginx
@@ -36,7 +38,7 @@ sudo mkdir -p /srv/www/weknora/releases/20260915-1
sudo tar -xzf weknora-site-v0.8.2.tar.gz -C /srv/www/weknora/releases/20260915-1
```
-解压后该目录下应直接有 `index.html`、`docs/`、`_next/`,无需再套一层 `static-site/`。
+解压后该目录下应直接有 `index.html`、`404.html`、`docs/`,无需再套一层 `static-site/`。
### 3. 配置域名根目录
diff --git a/website-docs/homepage/BRAND-ASSETS.md b/website-docs/homepage/BRAND-ASSETS.md
index 09f5af9a4..cbf288397 100644
--- a/website-docs/homepage/BRAND-ASSETS.md
+++ b/website-docs/homepage/BRAND-ASSETS.md
@@ -2,8 +2,10 @@
Logos identify supported integrations; their names and marks belong to their respective owners.
+Paths below written as `public/brand/…`, `public/brands/…` and `public/product/…` live under `public/docs/_home/`, so the site serves them from `/docs/_home/` next to the rest of the documentation.
+
- WeKnora logo: `docs/images/logo.png` from the WeKnora repository (the README logo), copied unchanged to `public/brand/weknora-original.png`. The site preserves all lettering, graphics and proportions. CSS hides only the empty outer canvas and blends the white background into the page; dark mode uses an inverted presentation with hue rotation. The source image remains unchanged.
-- WeKnora browser icon: copied unchanged from the existing product's `frontend/public/favicon.ico` into the homepage and documentation. The replacement square sail SVG is no longer shipped.
+- WeKnora browser icon: copied unchanged from the existing product's `frontend/public/favicon.ico` into the documentation (`/docs/favicon.ico`), which the homepage also uses. The replacement square sail SVG is no longer shipped.
- Feishu, GitLab, Tencent IMA, Notion, Yuque, RSS, WeCom, Slack, Telegram: copied unchanged from the WeKnora frontend asset library.
- OpenAI, DeepSeek, Qwen, Hunyuan, Gemini, Ollama, MCP: static SVGs from [Lobe Icons](https://github.com/lobehub/lobe-icons), `@lobehub/[email protected]`. Upstream MIT license included with assets.
- Confluence, DingTalk: copied unchanged from the WeKnora frontend asset library (`frontend/src/assets/img/datasource-confluence.svg`, `frontend/src/assets/img/im/dingtalk.svg`).
diff --git a/website-docs/homepage/README.md b/website-docs/homepage/README.md
index f8102c840..6ab9e0c45 100644
--- a/website-docs/homepage/README.md
+++ b/website-docs/homepage/README.md
@@ -7,5 +7,6 @@ The Next.js homepage is one part of the unified site. Run `npm run setup`, `npm
- `app/interactive.tsx`: responsive navigation, theme switch, and on-demand README video.
- `app/theme.ts`: VitePress-compatible theme persistence and pre-paint initialization.
- `../shared/brand.css`: shared light/dark design tokens.
+- `public/docs/_home/`: homepage images. The site serves only `/` and `/docs/`, so build output and public assets both live under `/docs/_home/` (`homeAssets` in `../shared/header.ts`).
`npm run dev` can still preview the homepage alone during development. `/docs/` requires the combined preview from the parent directory.
diff --git a/website-docs/homepage/app/brand-logo.tsx b/website-docs/homepage/app/brand-logo.tsx
index e92315def..58e239d5b 100644
--- a/website-docs/homepage/app/brand-logo.tsx
+++ b/website-docs/homepage/app/brand-logo.tsx
@@ -1,6 +1,7 @@
import Image from "next/image";
+import { homeAssets } from "../../shared/header";
/** Show the complete original artwork; the viewport only trims blank canvas. */
export function BrandLogo({ priority = false }: { priority?: boolean }) {
- return <span className="wk-logo"><Image src="/brand/weknora-original.png" alt="WeKnora" width={945} height={650} priority={priority} /></span>;
+ return <span className="wk-logo"><Image src={`${homeAssets}/brand/weknora-original.png`} alt="WeKnora" width={945} height={650} priority={priority} /></span>;
}
diff --git a/website-docs/homepage/app/brands.tsx b/website-docs/homepage/app/brands.tsx
index 47989f3e1..198541fd9 100644
--- a/website-docs/homepage/app/brands.tsx
+++ b/website-docs/homepage/app/brands.tsx
@@ -1,5 +1,6 @@
import Image from "next/image";
import { Icon } from "./ui";
+import { homeAssets } from "../../shared/header";
type Integration = { name: string; logo: string } | { name: string; icon: string };
@@ -47,7 +48,7 @@ export const modelProviders: Integration[] = [
export function IntegrationMark({ item }: { item: Integration }) {
return <>
{"logo" in item
- ? <Image src={`/brands/${item.logo}`} alt="" aria-hidden="true" width={22} height={22} />
+ ? <Image src={`${homeAssets}/brands/${item.logo}`} alt="" aria-hidden="true" width={22} height={22} />
: <Icon name={item.icon} />}
{item.name}
</>;
diff --git a/website-docs/homepage/app/favicon.ico b/website-docs/homepage/app/favicon.ico
deleted file mode 100644
index c8931efa9..000000000
Binary files a/website-docs/homepage/app/favicon.ico and /dev/null differ
diff --git a/website-docs/homepage/app/interactive.tsx b/website-docs/homepage/app/interactive.tsx
index c26d4ec19..d488eadd7 100644
--- a/website-docs/homepage/app/interactive.tsx
+++ b/website-docs/homepage/app/interactive.tsx
@@ -1,10 +1,9 @@
"use client";
-import Link from "next/link";
import { BrandLogo } from "./brand-logo";
import { useRef, useState, useSyncExternalStore } from "react";
import { Icon } from "./ui";
import { getThemeSnapshot, subscribeToTheme, toggleTheme } from "./theme";
-import { siteNavigation, repositoryUrl, headerIcons } from "../../shared/header";
+import { siteNavigation, repositoryUrl, headerIcons, homeAssets } from "../../shared/header";
import s from "./home.module.css";
const videoUrl = "https://github.com/user-attachments/assets/2819598d-3140-4623-814a-8162a22b653c";
@@ -21,7 +20,7 @@ export function Header() {
const menu = useRef<HTMLButtonElement>(null);
return <header className="wk-header" onKeyDown={event => { if (event.key === "Escape" && open) { setOpen(false); menu.current?.focus(); } }}>
<div className="wk-header-inner">
- <Link className="wk-brand" href="/" aria-label="WeKnora 首页"><BrandLogo priority /></Link>
+ <a className="wk-brand" href="/" aria-label="WeKnora 首页"><BrandLogo priority /></a>
<nav id="main-navigation" className={`wk-navigation ${open ? "is-open" : ""}`} aria-label="主导航" onClick={() => setOpen(false)}>
{siteNavigation.map(item => <a key={item.href} href={item.href}>{item.label}{item.badge && <span className="wk-new-label">{item.badge}</span>}</a>)}
<a className="wk-mobile-github" href={repositoryUrl} target="_blank" rel="noreferrer">GitHub <HeaderIcon name="external" /></a>
@@ -48,7 +47,7 @@ export function ProductVideo() {
return <figure id="demo" className={s.videoFigure}>
<div className={s.videoTop}><span>产品演示 <span className={s.videoDot}>/</span> PRODUCT FILM</span><span>02:25 <span className={s.videoDot}>/</span> 1080P</span></div>
<div className={s.videoStage}>
- <video ref={player} controls={started} playsInline preload="none" poster="/product/agent-chat.png" aria-label="WeKnora 产品介绍,英文旁白,中英字幕" aria-describedby="video-caption" tabIndex={started ? 0 : -1} onError={() => setFailed(true)} />
+ <video ref={player} controls={started} playsInline preload="none" poster={`${homeAssets}/product/agent-chat.png`} aria-label="WeKnora 产品介绍,英文旁白,中英字幕" aria-describedby="video-caption" tabIndex={started ? 0 : -1} onError={() => setFailed(true)} />
{!started && <button className={s.videoCover} onClick={play} aria-label="播放 WeKnora 产品介绍视频,2 分 25 秒"><span className={s.playCircle}><Icon name="play" /></span><span className={s.videoCoverTitle}>WeKnora 产品演示</span><span className={s.videoCoverHint}>播放产品介绍 · 2 分 25 秒</span></button>}
{failed && <div className={s.videoError} role="status"><p>视频暂时无法加载</p><a href={videoUrl} target="_blank" rel="noreferrer">在 GitHub 打开原视频 <Icon name="external" /></a></div>}
</div>
diff --git a/website-docs/homepage/app/layout.tsx b/website-docs/homepage/app/layout.tsx
index 7740af840..bb7800b00 100644
--- a/website-docs/homepage/app/layout.tsx
+++ b/website-docs/homepage/app/layout.tsx
@@ -5,6 +5,8 @@ import { themeInitializationScript } from "./theme";
export const metadata: Metadata = {
title: "WeKnora — 帮你找到答案,并将知识付诸实践",
description: "腾讯开源知识框架 WeKnora,集 RAG 问答、Agent 推理与自动 Wiki 于一体。v0.8.2 让智能体操作本机浏览器、以 MCP Server 对外提供知识库,并支持对话分叉与回滚;支持私有化部署。",
+ // Reuse the documentation favicon so the homepage adds nothing at the site root.
+ icons: { icon: "/docs/favicon.ico" },
};
export default function RootLayout({
diff --git a/website-docs/homepage/app/page.tsx b/website-docs/homepage/app/page.tsx
index f027802e1..0915db961 100644
--- a/website-docs/homepage/app/page.tsx
+++ b/website-docs/homepage/app/page.tsx
@@ -1,9 +1,9 @@
import { existsSync } from "node:fs";
import { join } from "node:path";
import Image from "next/image";
-import Link from "next/link";
import { BrandLogo } from "./brand-logo";
import { Icon } from "./ui";
+import { homeAssets } from "../../shared/header";
import { ProductGallery, type GalleryShot, type GallerySlide } from "./product-gallery";
import { Header, ProductVideo } from "./interactive";
import { clients, dataSources, modelProviders, IntegrationMark } from "./brands";
@@ -23,7 +23,7 @@ const productShotExists = (src: string) => existsSync(join(process.cwd(), "publi
type SlideSource = Omit<GallerySlide, "shots"> & ({ image: string; alt: string } | { shots: Omit<GalleryShot, "available">[] });
const withAvailability = (slide: SlideSource): GallerySlide => {
const shots = "shots" in slide ? slide.shots : [{ image: slide.image, alt: slide.alt }];
- return { name: slide.name, icon: slide.icon, title: slide.title, description: slide.description, link: slide.link, external: slide.external, shots: shots.map(shot => ({ ...shot, available: productShotExists(`/product/${shot.image}.png`) })) };
+ return { name: slide.name, icon: slide.icon, title: slide.title, description: slide.description, link: slide.link, external: slide.external, shots: shots.map(shot => ({ ...shot, available: productShotExists(`${homeAssets}/product/${shot.image}.png`) })) };
};
const releaseSlides = [
{ name: "本机浏览器", icon: "browser", shots: [
@@ -107,13 +107,13 @@ export default function Home() {
<div className={s.sectionHeading}><div><p className={s.eyebrow}>GET STARTED</p><h2 id="closing-title">选择适合你的使用方式。</h2></div></div>
<div className={s.startGrid}>
<article className={s.startCard}>
- <div className={s.startLabel}><Image className={s.startBrand} src="/brands/wechat-dialog.png" alt="微信对话开放平台 Logo" width={32} height={32} /><span>在线使用</span></div>
+ <div className={s.startLabel}><Image className={s.startBrand} src={`${homeAssets}/brands/wechat-dialog.png`} alt="微信对话开放平台 Logo" width={32} height={32} /><span>在线使用</span></div>
<h3>微信对话开放平台</h3>
<p>在线管理知识库,将问答服务接入公众号、小程序等微信场景。</p>
<a className={s.textLink} href="https://chatbot.weixin.qq.com/login" target="_blank" rel="noreferrer">进入平台 <Icon name="external" /></a>
</article>
<article className={s.startCard}>
- <div className={s.startLabel}><Image className={s.startBrand} src="/brands/tencent-cloud.ico" alt="腾讯云 Logo" width={32} height={32} /><span>云端部署</span></div>
+ <div className={s.startLabel}><Image className={s.startBrand} src={`${homeAssets}/brands/tencent-cloud.ico`} alt="腾讯云 Logo" width={32} height={32} /><span>云端部署</span></div>
<h3>腾讯云轻量应用服务器</h3>
<p>通过应用模板部署 WeKnora,在自己的云服务器上运行。</p>
<a className={s.textLink} href="https://mc.tencent.com/s69nKCVz" target="_blank" rel="noreferrer">前往腾讯云部署 <Icon name="external" /></a>
@@ -127,6 +127,6 @@ export default function Home() {
</div>
</section>
</main>
- <footer className={`${s.shell} ${s.footer}`}><Link className={s.brand} href="/" aria-label="WeKnora 首页"><BrandLogo /></Link><p>Tencent Open Source · MIT License</p><nav aria-label="页脚导航"><a href={docs}>文档</a><a href={repo} target="_blank" rel="noreferrer">GitHub <Icon name="external" /></a><a href={`${repo}/blob/main/CHANGELOG.md`} target="_blank" rel="noreferrer">更新日志</a></nav></footer>
+ <footer className={`${s.shell} ${s.footer}`}><a className={s.brand} href="/" aria-label="WeKnora 首页"><BrandLogo /></a><p>Tencent Open Source · MIT License</p><nav aria-label="页脚导航"><a href={docs}>文档</a><a href={repo} target="_blank" rel="noreferrer">GitHub <Icon name="external" /></a><a href={`${repo}/blob/main/CHANGELOG.md`} target="_blank" rel="noreferrer">更新日志</a></nav></footer>
</div>;
}
diff --git a/website-docs/homepage/app/product-gallery.tsx b/website-docs/homepage/app/product-gallery.tsx
index 9f64e0f0c..feaf83ffc 100644
--- a/website-docs/homepage/app/product-gallery.tsx
+++ b/website-docs/homepage/app/product-gallery.tsx
@@ -3,6 +3,7 @@
import Image from "next/image";
import { useEffect, useRef, useState, type CSSProperties } from "react";
import { Icon } from "./ui";
+import { homeAssets } from "../../shared/header";
import s from "./home.module.css";
export type GalleryShot = { label?: string; icon?: string; image: string; alt: string; available: boolean };
@@ -91,7 +92,7 @@ export function ProductGallery({ id, label, slides }: { id: string; label: strin
</div>}
{(slide.link || slide.external) && <div className={s.slideLinks}>
{slide.link && <a className={s.textLink} href={slide.link}>了解更多 <Icon name="arrow" /></a>}
- {slide.external && <a className={`${s.textLink} ${s.externalLink}`} href={slide.external.href} target="_blank" rel="noreferrer">{slide.external.logo && <Image src={`/brands/${slide.external.logo}`} alt="" aria-hidden="true" width={20} height={20} />}{slide.external.label}<Icon name="github" /></a>}
+ {slide.external && <a className={`${s.textLink} ${s.externalLink}`} href={slide.external.href} target="_blank" rel="noreferrer">{slide.external.logo && <Image src={`${homeAssets}/brands/${slide.external.logo}`} alt="" aria-hidden="true" width={20} height={20} />}{slide.external.label}<Icon name="github" /></a>}
</div>}
</div>
</div>)}
@@ -101,7 +102,7 @@ export function ProductGallery({ id, label, slides }: { id: string; label: strin
<span><Icon name={activeShot.icon ?? active.icon} />{active.name}{active.shots.length > 1 && activeShot.label && <em className={s.viewLabel}>· {activeShot.label}</em>}</span>
<div className={s.cardActions}>
{activeShot.available
- ? <a className={s.textLink} href={`/product/${activeShot.image}.png`} target="_blank" rel="noreferrer" aria-label={`查看${active.name}原图(新窗口)`}>查看原图 <Icon name="external" /></a>
+ ? <a className={s.textLink} href={`${homeAssets}/product/${activeShot.image}.png`} target="_blank" rel="noreferrer" aria-label={`查看${active.name}原图(新窗口)`}>查看原图 <Icon name="external" /></a>
: <span className={s.pendingLabel}>待补充</span>}
</div>
</div>
@@ -111,8 +112,8 @@ export function ProductGallery({ id, label, slides }: { id: string; label: strin
const current = index === item && shotIndex === shot;
return <div key={entry.image} className={s.shotLayer} data-active={current} aria-hidden={!current}>
{entry.available
- ? <Image src={`/product/${entry.image}.png`} alt={entry.alt} width={3840} height={2112} sizes="(min-width: 1100px) 60vw, 100vw" />
- : <div className={s.shotPlaceholder} role="img" aria-label={entry.alt}><span>截图待补充</span><code>{`website-docs/homepage/public/product/${entry.image}.png`}</code></div>}
+ ? <Image src={`${homeAssets}/product/${entry.image}.png`} alt={entry.alt} width={3840} height={2112} sizes="(min-width: 1100px) 60vw, 100vw" />
+ : <div className={s.shotPlaceholder} role="img" aria-label={entry.alt}><span>截图待补充</span><code>{`website-docs/homepage/public${homeAssets}/product/${entry.image}.png`}</code></div>}
</div>;
}))}
</div>
diff --git a/website-docs/homepage/eslint.config.mjs b/website-docs/homepage/eslint.config.mjs
index 05e726d1b..15ea9748b 100644
--- a/website-docs/homepage/eslint.config.mjs
+++ b/website-docs/homepage/eslint.config.mjs
@@ -5,6 +5,13 @@ import nextTs from "eslint-config-next/typescript";
const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
+ {
+ rules: {
+ // <Link> navigation fetches RSC payloads from the site root, which the
+ // upstream router does not forward; plain links reload `/` instead.
+ "@next/next/no-html-link-for-pages": "off",
+ },
+ },
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
diff --git a/website-docs/homepage/next.config.ts b/website-docs/homepage/next.config.ts
index e3a4caa39..eb6d79a9a 100644
--- a/website-docs/homepage/next.config.ts
+++ b/website-docs/homepage/next.config.ts
@@ -1,9 +1,12 @@
import type { NextConfig } from "next";
import { resolve } from "node:path";
+import { homeAssets } from "../shared/header";
const nextConfig: NextConfig = {
turbopack: { root: resolve(__dirname, "..") },
output: "export",
+ // Chunks are requested from /docs/_home/_next/; build-site.mjs moves out/_next there.
+ assetPrefix: homeAssets,
trailingSlash: true,
images: {
unoptimized: true,
diff --git a/website-docs/homepage/public/brand/weknora-original.png b/website-docs/homepage/public/docs/_home/brand/weknora-original.png
similarity index 100%
rename from website-docs/homepage/public/brand/weknora-original.png
rename to website-docs/homepage/public/docs/_home/brand/weknora-original.png
diff --git a/website-docs/homepage/public/brands/BROWSERSKILL-LICENSE b/website-docs/homepage/public/docs/_home/brands/BROWSERSKILL-LICENSE
similarity index 100%
rename from website-docs/homepage/public/brands/BROWSERSKILL-LICENSE
rename to website-docs/homepage/public/docs/_home/brands/BROWSERSKILL-LICENSE
diff --git a/website-docs/homepage/public/brands/LOBE-ICONS-LICENSE b/website-docs/homepage/public/docs/_home/brands/LOBE-ICONS-LICENSE
similarity index 100%
rename from website-docs/homepage/public/brands/LOBE-ICONS-LICENSE
rename to website-docs/homepage/public/docs/_home/brands/LOBE-ICONS-LICENSE
diff --git a/website-docs/homepage/public/brands/anthropic.svg b/website-docs/homepage/public/docs/_home/brands/anthropic.svg
similarity index 100%
rename from website-docs/homepage/public/brands/anthropic.svg
rename to website-docs/homepage/public/docs/_home/brands/anthropic.svg
diff --git a/website-docs/homepage/public/brands/browserskill.png b/website-docs/homepage/public/docs/_home/brands/browserskill.png
similarity index 100%
rename from website-docs/homepage/public/brands/browserskill.png
rename to website-docs/homepage/public/docs/_home/brands/browserskill.png
diff --git a/website-docs/homepage/public/brands/chrome.svg b/website-docs/homepage/public/docs/_home/brands/chrome.svg
similarity index 100%
rename from website-docs/homepage/public/brands/chrome.svg
rename to website-docs/homepage/public/docs/_home/brands/chrome.svg
diff --git a/website-docs/homepage/public/brands/confluence.svg b/website-docs/homepage/public/docs/_home/brands/confluence.svg
similarity index 100%
rename from website-docs/homepage/public/brands/confluence.svg
rename to website-docs/homepage/public/docs/_home/brands/confluence.svg
diff --git a/website-docs/homepage/public/brands/deepseek-color.svg b/website-docs/homepage/public/docs/_home/brands/deepseek-color.svg
similarity index 100%
rename from website-docs/homepage/public/brands/deepseek-color.svg
rename to website-docs/homepage/public/docs/_home/brands/deepseek-color.svg
diff --git a/website-docs/homepage/public/brands/dingtalk.svg b/website-docs/homepage/public/docs/_home/brands/dingtalk.svg
similarity index 100%
rename from website-docs/homepage/public/brands/dingtalk.svg
rename to website-docs/homepage/public/docs/_home/brands/dingtalk.svg
diff --git a/website-docs/homepage/public/brands/feishu.ico b/website-docs/homepage/public/docs/_home/brands/feishu.ico
similarity index 100%
rename from website-docs/homepage/public/brands/feishu.ico
rename to website-docs/homepage/public/docs/_home/brands/feishu.ico
diff --git a/website-docs/homepage/public/brands/gemini-color.svg b/website-docs/homepage/public/docs/_home/brands/gemini-color.svg
similarity index 100%
rename from website-docs/homepage/public/brands/gemini-color.svg
rename to website-docs/homepage/public/docs/_home/brands/gemini-color.svg
diff --git a/website-docs/homepage/public/brands/gitlab.png b/website-docs/homepage/public/docs/_home/brands/gitlab.png
similarity index 100%
rename from website-docs/homepage/public/brands/gitlab.png
rename to website-docs/homepage/public/docs/_home/brands/gitlab.png
diff --git a/website-docs/homepage/public/brands/hunyuan-color.svg b/website-docs/homepage/public/docs/_home/brands/hunyuan-color.svg
similarity index 100%
rename from website-docs/homepage/public/brands/hunyuan-color.svg
rename to website-docs/homepage/public/docs/_home/brands/hunyuan-color.svg
diff --git a/website-docs/homepage/public/brands/ima.png b/website-docs/homepage/public/docs/_home/brands/ima.png
similarity index 100%
rename from website-docs/homepage/public/brands/ima.png
rename to website-docs/homepage/public/docs/_home/brands/ima.png
diff --git a/website-docs/homepage/public/brands/litellm.ico b/website-docs/homepage/public/docs/_home/brands/litellm.ico
similarity index 100%
rename from website-docs/homepage/public/brands/litellm.ico
rename to website-docs/homepage/public/docs/_home/brands/litellm.ico
diff --git a/website-docs/homepage/public/brands/mcp.svg b/website-docs/homepage/public/docs/_home/brands/mcp.svg
similarity index 100%
rename from website-docs/homepage/public/brands/mcp.svg
rename to website-docs/homepage/public/docs/_home/brands/mcp.svg
diff --git a/website-docs/homepage/public/brands/minimax.svg b/website-docs/homepage/public/docs/_home/brands/minimax.svg
similarity index 100%
rename from website-docs/homepage/public/brands/minimax.svg
rename to website-docs/homepage/public/docs/_home/brands/minimax.svg
diff --git a/website-docs/homepage/public/brands/moonshot.svg b/website-docs/homepage/public/docs/_home/brands/moonshot.svg
similarity index 100%
rename from website-docs/homepage/public/brands/moonshot.svg
rename to website-docs/homepage/public/docs/_home/brands/moonshot.svg
diff --git a/website-docs/homepage/public/brands/notion.ico b/website-docs/homepage/public/docs/_home/brands/notion.ico
similarity index 100%
rename from website-docs/homepage/public/brands/notion.ico
rename to website-docs/homepage/public/docs/_home/brands/notion.ico
diff --git a/website-docs/homepage/public/brands/ollama.svg b/website-docs/homepage/public/docs/_home/brands/ollama.svg
similarity index 100%
rename from website-docs/homepage/public/brands/ollama.svg
rename to website-docs/homepage/public/docs/_home/brands/ollama.svg
diff --git a/website-docs/homepage/public/brands/openai.svg b/website-docs/homepage/public/docs/_home/brands/openai.svg
similarity index 100%
rename from website-docs/homepage/public/brands/openai.svg
rename to website-docs/homepage/public/docs/_home/brands/openai.svg
diff --git a/website-docs/homepage/public/brands/qwen-color.svg b/website-docs/homepage/public/docs/_home/brands/qwen-color.svg
similarity index 100%
rename from website-docs/homepage/public/brands/qwen-color.svg
rename to website-docs/homepage/public/docs/_home/brands/qwen-color.svg
diff --git a/website-docs/homepage/public/brands/rss.svg b/website-docs/homepage/public/docs/_home/brands/rss.svg
similarity index 100%
rename from website-docs/homepage/public/brands/rss.svg
rename to website-docs/homepage/public/docs/_home/brands/rss.svg
diff --git a/website-docs/homepage/public/brands/slack.svg b/website-docs/homepage/public/docs/_home/brands/slack.svg
similarity index 100%
rename from website-docs/homepage/public/brands/slack.svg
rename to website-docs/homepage/public/docs/_home/brands/slack.svg
diff --git a/website-docs/homepage/public/brands/telegram.svg b/website-docs/homepage/public/docs/_home/brands/telegram.svg
similarity index 100%
rename from website-docs/homepage/public/brands/telegram.svg
rename to website-docs/homepage/public/docs/_home/brands/telegram.svg
diff --git a/website-docs/homepage/public/brands/tencent-cloud.ico b/website-docs/homepage/public/docs/_home/brands/tencent-cloud.ico
similarity index 100%
rename from website-docs/homepage/public/brands/tencent-cloud.ico
rename to website-docs/homepage/public/docs/_home/brands/tencent-cloud.ico
diff --git a/website-docs/homepage/public/brands/volcengine.svg b/website-docs/homepage/public/docs/_home/brands/volcengine.svg
similarity index 100%
rename from website-docs/homepage/public/brands/volcengine.svg
rename to website-docs/homepage/public/docs/_home/brands/volcengine.svg
diff --git a/website-docs/homepage/public/brands/wechat-dialog.png b/website-docs/homepage/public/docs/_home/brands/wechat-dialog.png
similarity index 100%
rename from website-docs/homepage/public/brands/wechat-dialog.png
rename to website-docs/homepage/public/docs/_home/brands/wechat-dialog.png
diff --git a/website-docs/homepage/public/brands/wecom.svg b/website-docs/homepage/public/docs/_home/brands/wecom.svg
similarity index 100%
rename from website-docs/homepage/public/brands/wecom.svg
rename to website-docs/homepage/public/docs/_home/brands/wecom.svg
diff --git a/website-docs/homepage/public/brands/yuque.ico b/website-docs/homepage/public/docs/_home/brands/yuque.ico
similarity index 100%
rename from website-docs/homepage/public/brands/yuque.ico
rename to website-docs/homepage/public/docs/_home/brands/yuque.ico
diff --git a/website-docs/homepage/public/brands/zhipu.svg b/website-docs/homepage/public/docs/_home/brands/zhipu.svg
similarity index 100%
rename from website-docs/homepage/public/brands/zhipu.svg
rename to website-docs/homepage/public/docs/_home/brands/zhipu.svg
diff --git a/website-docs/homepage/public/product/agent-chat.png b/website-docs/homepage/public/docs/_home/product/agent-chat.png
similarity index 100%
rename from website-docs/homepage/public/product/agent-chat.png
rename to website-docs/homepage/public/docs/_home/product/agent-chat.png
diff --git a/website-docs/homepage/public/product/browser-connection.png b/website-docs/homepage/public/docs/_home/product/browser-connection.png
similarity index 100%
rename from website-docs/homepage/public/product/browser-connection.png
rename to website-docs/homepage/public/docs/_home/product/browser-connection.png
diff --git a/website-docs/homepage/public/product/chat-steer-queue.png b/website-docs/homepage/public/docs/_home/product/chat-steer-queue.png
similarity index 100%
rename from website-docs/homepage/public/product/chat-steer-queue.png
rename to website-docs/homepage/public/docs/_home/product/chat-steer-queue.png
diff --git a/website-docs/homepage/public/product/local-browser-task.png b/website-docs/homepage/public/docs/_home/product/local-browser-task.png
similarity index 100%
rename from website-docs/homepage/public/product/local-browser-task.png
rename to website-docs/homepage/public/docs/_home/product/local-browser-task.png
diff --git a/website-docs/homepage/public/product/mcp-server-endpoint.png b/website-docs/homepage/public/docs/_home/product/mcp-server-endpoint.png
similarity index 100%
rename from website-docs/homepage/public/product/mcp-server-endpoint.png
rename to website-docs/homepage/public/docs/_home/product/mcp-server-endpoint.png
diff --git a/website-docs/homepage/public/product/sandbox-desktop.png b/website-docs/homepage/public/docs/_home/product/sandbox-desktop.png
similarity index 100%
rename from website-docs/homepage/public/product/sandbox-desktop.png
rename to website-docs/homepage/public/docs/_home/product/sandbox-desktop.png
diff --git a/website-docs/homepage/public/product/sandbox-terminal.png b/website-docs/homepage/public/docs/_home/product/sandbox-terminal.png
similarity index 100%
rename from website-docs/homepage/public/product/sandbox-terminal.png
rename to website-docs/homepage/public/docs/_home/product/sandbox-terminal.png
diff --git a/website-docs/homepage/public/product/skill-catalog.png b/website-docs/homepage/public/docs/_home/product/skill-catalog.png
similarity index 100%
rename from website-docs/homepage/public/product/skill-catalog.png
rename to website-docs/homepage/public/docs/_home/product/skill-catalog.png
diff --git a/website-docs/homepage/public/product/skill-sandbox-chat.png b/website-docs/homepage/public/docs/_home/product/skill-sandbox-chat.png
similarity index 100%
rename from website-docs/homepage/public/product/skill-sandbox-chat.png
rename to website-docs/homepage/public/docs/_home/product/skill-sandbox-chat.png
diff --git a/website-docs/homepage/public/product/wiki-browser.png b/website-docs/homepage/public/docs/_home/product/wiki-browser.png
similarity index 100%
rename from website-docs/homepage/public/product/wiki-browser.png
rename to website-docs/homepage/public/docs/_home/product/wiki-browser.png
diff --git a/website-docs/homepage/public/product/wiki-graph.png b/website-docs/homepage/public/docs/_home/product/wiki-graph.png
similarity index 100%
rename from website-docs/homepage/public/product/wiki-graph.png
rename to website-docs/homepage/public/docs/_home/product/wiki-graph.png
diff --git a/website-docs/homepage/public/product/wiki-revision-history.png b/website-docs/homepage/public/docs/_home/product/wiki-revision-history.png
similarity index 100%
rename from website-docs/homepage/public/product/wiki-revision-history.png
rename to website-docs/homepage/public/docs/_home/product/wiki-revision-history.png
diff --git a/website-docs/homepage/scripts/audit-content.mjs b/website-docs/homepage/scripts/audit-content.mjs
index 5835b01e8..108c9091f 100644
--- a/website-docs/homepage/scripts/audit-content.mjs
+++ b/website-docs/homepage/scripts/audit-content.mjs
@@ -17,7 +17,7 @@ assert.match(html, /https:\/\/github.com\/user-attachments\/assets\/2819598d-314
assert.ok(!/<video[^>]+autoplay/i.test(html), 'Do not autoplay the product film');
const wiki = html.match(/<section id="wiki"[\s\S]*?<\/section>/)?.[0];
assert.ok(wiki, 'The homepage must include a dedicated Wiki section');
-for (const term of ['/product/wiki-browser.png', '/product/wiki-graph.png', '/product/wiki-revision-history.png', 'id="wiki-gallery"', '/docs/03-features/14-wiki.html', '来源引用', '知识图谱', '版本差异']) {
+for (const term of ['/docs/_home/product/wiki-browser.png', '/docs/_home/product/wiki-graph.png', '/docs/_home/product/wiki-revision-history.png', 'id="wiki-gallery"', '/docs/03-features/14-wiki.html', '来源引用', '知识图谱', '版本差异']) {
assert.ok(wiki.includes(term), `Missing Wiki showcase content: ${term}`);
}
const ids = new Set([...html.matchAll(/\bid="([^"]+)"/g)].map(match => match[1]));
@@ -31,9 +31,9 @@ for (const asset of assets) {
if (file.isDirectory()) file = await stat(join(path, 'index.html'));
assert.ok(file.isFile() && file.size > 0, `Missing local asset: ${asset}`);
}
-const pendingShots = [...html.matchAll(/website-docs\/homepage\/public(\/product\/[\w.-]+)/g)].map(match => match[1]);
+const pendingShots = [...html.matchAll(/website-docs\/homepage\/public(\/docs\/_home\/product\/[\w.-]+)/g)].map(match => match[1]);
// Gallery slides without a file render their placeholder only once selected; read the flag from the page data.
-for (const [, image] of html.matchAll(/\\?"image\\?":\\?"([\w-]+)\\?"[^{}]*?\\?"available\\?":false/g)) pendingShots.push(`/product/${image}.png`);
+for (const [, image] of html.matchAll(/\\?"image\\?":\\?"([\w-]+)\\?"[^{}]*?\\?"available\\?":false/g)) pendingShots.push(`/docs/_home/product/${image}.png`);
if (pendingShots.length) console.warn(`Product screenshots still pending (placeholder shown): ${[...new Set(pendingShots)].join(', ')}`);
assert.match(html, /aria-controls="main-navigation"/);
assert.match(html, /aria-label="播放 WeKnora 产品介绍视频/);
diff --git a/website-docs/scripts/build-site.mjs b/website-docs/scripts/build-site.mjs
index c03a8c12d..73734fb95 100644
--- a/website-docs/scripts/build-site.mjs
+++ b/website-docs/scripts/build-site.mjs
@@ -1,5 +1,5 @@
import { spawnSync } from 'node:child_process';
-import { cpSync, rmSync, existsSync } from 'node:fs';
+import { cpSync, rmSync, existsSync, readdirSync, renameSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
@@ -14,7 +14,15 @@ run('homepage', 'build');
run('.', 'check:docs');
run('.', 'build:docs');
const output = resolve(root, 'homepage/out');
-rmSync(resolve(output, 'docs'), { recursive: true, force: true });
+// The upstream router forwards only `/` and `/docs/`, so the export keeps just the
+// two HTML entry points at the root. Chunks join the public assets under
+// /docs/_home/ (next.config.ts assetPrefix); RSC payloads and the not-found
+// route are never requested because the homepage uses plain links.
+const homeAssets = resolve(output, 'docs/_home');
+renameSync(resolve(output, '_next'), resolve(homeAssets, '_next'));
+for (const entry of readdirSync(output)) {
+ if (!['index.html', '404.html', 'docs'].includes(entry)) rmSync(resolve(output, entry), { recursive: true, force: true });
+}
cpSync(resolve(root, '.vitepress/dist'), resolve(output, 'docs'), { recursive: true });
run('homepage', 'audit:content');
const check = spawnSync(process.execPath, ['scripts/check-site.mjs', output], { cwd: root, stdio: 'inherit' });
diff --git a/website-docs/scripts/check-site.mjs b/website-docs/scripts/check-site.mjs
index a511e23a1..0756c6936 100644
--- a/website-docs/scripts/check-site.mjs
+++ b/website-docs/scripts/check-site.mjs
@@ -18,6 +18,9 @@ for (const retired of ['/demo/', '/demo/1/', '/redesign/', '/redesign/1/', '/dem
assert.equal(await resolveSiteFile(root, retired), null, `Retired demo must not be published: ${retired}`);
}
const failures = [];
+for (const entry of await readdir(root)) {
+ if (!['index.html', '404.html', 'docs'].includes(entry)) failures.push(`/${entry}: only index.html, 404.html and docs/ may sit at the site root`);
+}
// Screenshot.vue renders a labelled placeholder until the image is added, so a
// missing docs screenshot is reported as pending instead of failing the build.
const pendingShots = new Set();
@@ -32,6 +35,8 @@ for (const file of pages) {
for (const [, raw] of tag.matchAll(/(?:href|src|poster)="([^"]+)"/g)) {
const url = new URL(raw.replaceAll('&amp;', '&'), base);
if (url.origin !== base.origin) continue;
+ // The upstream router forwards only these two prefixes to this service.
+ if (url.pathname !== base.pathname && url.pathname !== '/' && !url.pathname.startsWith('/docs/')) failures.push(`${route}: ${url.pathname} is outside / and /docs/`);
if (!checked.has(url.pathname)) checked.set(url.pathname, !!await resolveSiteFile(root, url.pathname));
if (!checked.get(url.pathname)) {
if (/class="wk-shot-img"/.test(tag) && url.pathname.startsWith('/docs/screenshots/')) pendingShots.add(url.pathname);
diff --git a/website-docs/scripts/test-docker.mjs b/website-docs/scripts/test-docker.mjs
index 53860028f..c00ef2794 100644
--- a/website-docs/scripts/test-docker.mjs
+++ b/website-docs/scripts/test-docker.mjs
@@ -67,7 +67,7 @@ try {
assert.equal(redirect.status, 308);
assert.equal(new URL(redirect.headers.get('location'), origin).origin, origin);
assert.equal(new URL(redirect.headers.get('location'), origin).pathname, '/docs/');
- const assets = new Set(['/brand/weknora-original.png', '/product/wiki-browser.png', '/docs/favicon.ico']);
+ const assets = new Set(['/docs/_home/brand/weknora-original.png', '/docs/_home/product/wiki-browser.png', '/docs/favicon.ico']);
for (const path of ['/', '/docs/', '/docs/03-features/14-wiki', '/docs/03-features/14-wiki.html']) {
const response = await fetch(origin + path);
assert.equal(response.status, 200, path);
@@ -82,7 +82,7 @@ try {
if (url.origin === origin) assets.add(url.pathname);
}
}
- assert.ok([...assets].some(path => path.startsWith('/_next/')), 'Homepage scripts are missing');
+ assert.ok([...assets].some(path => path.startsWith('/docs/_home/_next/')), 'Homepage scripts are missing');
assert.ok([...assets].some(path => path.startsWith('/docs/assets/')), 'Documentation scripts are missing');
for (const asset of assets) {
const response = await fetch(origin + asset);
diff --git a/website-docs/scripts/test-integration.mjs b/website-docs/scripts/test-integration.mjs
index c864f8442..7c459d8a2 100644
--- a/website-docs/scripts/test-integration.mjs
+++ b/website-docs/scripts/test-integration.mjs
@@ -178,7 +178,7 @@ try {
const image = document.querySelector('.wk-brand img');
return image?.complete && image.naturalWidth === 945 && image.naturalHeight === 650;
});
- assert.equal(await page.locator('.wk-brand img').getAttribute('src'), '/brand/weknora-original.png');
+ assert.equal(await page.locator('.wk-brand img').getAttribute('src'), '/docs/_home/brand/weknora-original.png');
await checkVisibleControl(page, '.wk-theme-toggle');
}
}
diff --git a/website-docs/shared/header.ts b/website-docs/shared/header.ts
index 42e26c935..ece7ec067 100644
--- a/website-docs/shared/header.ts
+++ b/website-docs/shared/header.ts
@@ -6,6 +6,10 @@ export const siteNavigation = [
{ label: '企业部署', href: '/#enterprise', badge: '' },
{ label: '文档', href: '/docs/', badge: '' },
];
+// The site sits behind an upstream router that forwards only `/` and `/docs/`.
+// Everything else the homepage loads (Next chunks, images) is served from here:
+// Next's assetPrefix points at it and homepage/public mirrors the same path.
+export const homeAssets = '/docs/_home';
export const repositoryUrl = 'https://github.com/Tencent/WeKnora';
export const headerIcons: Record<string, string> = {
sun: 'M16 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5',