Skip to content

Commit 0391cda

Browse files
PB-1877 Set base path for test links
For test links, we need to take into account that there is a "/preview/feat-PB-1234-my-branch" in between. If we don't add this to the static asset links, it will result in broken styling, missing images and broken page links. See ["Base URL"](https://vitepress.dev/guide/asset-handling#base-url) in the VitePress docs.
1 parent a7f9db7 commit 0391cda

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.vitepress/config.mts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ import fs from "fs";
55
export default defineConfig({
66
title: "*.geo.admin.ch",
77
description: "Technical Documentation about *.geo.admin.ch",
8+
/*
9+
Prepend a base path such that links still work when the page is built for the
10+
preview in a PR ("test link" in the PR description).
11+
12+
For example, VITE_BASE_URL would be set to "/preview/feat-pb-1234-my-branch/"
13+
for a link like this:
14+
15+
https://sys-docs.dev.bgdi.ch/preview/feat-pb-1234-my-branch/index.html
16+
*/
17+
base: process.env.VITE_BASE_URL || '/',
818
head: [["link", { rel: "icon", href: "/favicon.ico" }]],
919
ignoreDeadLinks: "localhostLinks",
1020
vite: {

0 commit comments

Comments
 (0)