Skip to content

Fix VitePress base path for phenotype.space#68

Open
KooshaPari wants to merge 1 commit into
mainfrom
fix/asset-base-path
Open

Fix VitePress base path for phenotype.space#68
KooshaPari wants to merge 1 commit into
mainfrom
fix/asset-base-path

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Jun 27, 2026

Copy link
Copy Markdown
Owner

User description

Summary

  • Stop inferring subpath base from GITHUB_REPOSITORY on every CI build
  • Default to /; use /<repo>/ only when GITHUB_PAGES=true

Root cause

HTML referenced /Tokn/assets/... while deployed assets live at /assets/....

Test plan

  • Redeploy tokn.phenotype.space
  • Verify stylesheet href resolves with HTTP 200

Made with Cursor


CodeAnt-AI Description

Fix docs asset loading for custom-domain deployments

What Changed

  • Docs now use / as the base path on custom domains, so styles and other assets load from the site root instead of a repo subpath.
  • GitHub Pages project sites still use the repository name as the base path when needed.
  • An explicit docs base setting now takes priority if provided.

Impact

✅ Working docs styling on custom domains
✅ Fewer broken asset links after deploy
✅ Correct GitHub Pages and custom-domain behavior

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Only apply repo subpath base when GITHUB_PAGES is set; default to `/` so Cloudflare subdomain builds resolve CSS from `/assets/`.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@codeant-ai

codeant-ai Bot commented Jun 27, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@codeant-ai

codeant-ai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Jun 27, 2026
Comment thread docs/.vitepress/config.ts
Comment on lines +5 to 6
const explicit = process.env.DOCS_BASE ?? process.env.VITEPRESS_BASE
if (explicit) return explicit.endsWith('/') ? explicit : `${explicit}/`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The explicit base normalization only enforces a trailing slash, so values like Tokn become Tokn/ (missing leading slash), which produces invalid VitePress base paths and broken asset URLs. Normalize explicit values to include both leading and trailing / for path-style bases. [logic error]

Severity Level: Major ⚠️
⚠️ Docs builds with misconfigured DOCS_BASE produce bad asset paths.
⚠️ Any external CI setting `DOCS_BASE=Tokn` breaks docs site.
⚠️ VitePress base contract violated for non-slashed env overrides.
Steps of Reproduction ✅
1. Note the explicit base handling in `docs/.vitepress/config.ts:4-6`, where
`resolveDocsBase()` reads `DOCS_BASE` or `VITEPRESS_BASE` and only normalizes by appending
a trailing `/` if missing.

2. Set an explicit base without a leading slash, e.g. run the docs build locally from
`docs/` with `DOCS_BASE=Tokn npm run docs:build` (the same script used in
`.github/workflows/ci.yml:66-68`, which uses `npm run docs:build` with `working-directory:
docs`).

3. During the build, `resolveDocsBase()` will see `explicit === 'Tokn'` and return
`'Tokn/'`, because the code only checks `explicit.endsWith('/')`.

4. VitePress `defineConfig` at `docs/.vitepress/config.ts:15-18` sets `base: docsBase` to
`'Tokn/'`, which lacks the leading `/` required for valid VitePress base paths; generated
HTML will reference asset paths like `Tokn/assets/...` instead of `/Tokn/assets/...`,
causing broken asset URLs when served from a normal site root.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** docs/.vitepress/config.ts
**Line:** 5:6
**Comment:**
	*Logic Error: The explicit base normalization only enforces a trailing slash, so values like `Tokn` become `Tokn/` (missing leading slash), which produces invalid VitePress base paths and broken asset URLs. Normalize explicit values to include both leading and trailing `/` for path-style bases.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Jun 27, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2010eaf7d0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread docs/.vitepress/config.ts
}
if (process.env.PHENOTYPE_CUSTOM_DOMAIN === 'true') return '/'
const repo = process.env.GITHUB_REPOSITORY?.split('/')[1]
if (process.env.GITHUB_PAGES === 'true' && repo) return `/${repo}/`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Ensure custom-domain Pages builds skip the repo base

When the docs are built in a GitHub Pages workflow where GITHUB_PAGES=true, this branch still returns /Tokn/ unless the new PHENOTYPE_CUSTOM_DOMAIN variable is also set. I searched the repo for PHENOTYPE_CUSTOM_DOMAIN and it only appears in this config, so the documented phenotype.space custom-domain build can still emit /Tokn/assets/... and keep the broken asset URLs this commit is meant to fix unless every deploy workflow is updated separately.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant