Files
galaxy-game/site/.vitepress/config.ts
T
Ilia Denisov ec98639d49
Build · Site / build (push) Successful in 8s
Tests · Integration / integration (pull_request) Successful in 1m38s
Build · Site / build (pull_request) Successful in 10s
Tests · Go / test (pull_request) Failing after 3m0s
Tests · UI / test (pull_request) Successful in 2m35s
fix(site): link to the game with target=_self to avoid VitePress SPA 404
VitePress is a Vue SPA; a same-origin link to /game/ (a separate app, not
a VitePress page) was intercepted by its client router and rendered
VitePress's own 404 until a manual reload. Mark the game links (both
home pages and the nav item) target="_self" so the click is a real
browser navigation that the edge Caddy serves from the game bundle.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 19:13:15 +02:00

60 lines
1.9 KiB
TypeScript

import { defineConfig } from "vitepress";
// Galaxy project site. The single-origin deployment serves this static
// build at the root (`/`); the game UI lives under `/game/`. The site is
// Markdown-first with the default theme's two-column navigation (left:
// chapters; right: on-this-page), LaTeX math, and a minimal monospace
// theme. Internationalisation uses VitePress `locales`, which renders the
// built-in language switcher in the nav bar.
export default defineConfig({
title: "Galaxy",
description: "Galaxy — a turn-based space strategy game.",
cleanUrls: true,
// READMEs (this dir's and any future per-section ones) are developer
// docs, not site pages.
srcExclude: ["**/README.md"],
// The game UI is served from `/game/` by the edge Caddy, not by
// VitePress, so its links must skip the dead-link checker.
ignoreDeadLinks: [/^\/game\//],
markdown: {
// LaTeX via markdown-it-mathjax3: inline `$…$`, block `$$…$$`.
math: true,
},
themeConfig: {
outline: { level: [2, 3], label: "On this page" },
},
locales: {
root: {
label: "English",
lang: "en",
themeConfig: {
// The game is a separate app under /game/, not a VitePress page.
// target "_self" makes the link a real navigation (full load),
// not a client-side SPA route — otherwise VitePress shows its
// own 404 for the unknown route.
nav: [{ text: "Play", link: "/game/", target: "_self" }],
sidebar: [
{
text: "Galaxy",
items: [{ text: "Overview", link: "/" }],
},
],
},
},
ru: {
label: "Русский",
lang: "ru",
link: "/ru/",
themeConfig: {
nav: [{ text: "Играть", link: "/game/", target: "_self" }],
sidebar: [
{
text: "Galaxy",
items: [{ text: "Обзор", link: "/ru/" }],
},
],
},
},
},
});