Skip to content

Serve the site at the domain root instead of /documentdb.github.io - #106

Merged
guanzhousongmicrosoft merged 1 commit into
documentdb:mainfrom
GuanzhouSong:fix/serve-site-at-domain-root
Jul 30, 2026
Merged

Serve the site at the domain root instead of /documentdb.github.io#106
guanzhousongmicrosoft merged 1 commit into
documentdb:mainfrom
GuanzhouSong:fix/serve-site-at-domain-root

Conversation

@GuanzhouSong

Copy link
Copy Markdown
Contributor

Problem

This repo is the organization Pages site with a custom domain — the deployed artifact is served at the root of documentdb.io. The deploy workflow builds with NEXT_BASE_PATH: ${{ github.event.repository.name }} (the standard trick for project pages), so every internal link and asset URL is emitted as /documentdb.github.io/....

Verified against the live site:

  • Every internal link, stylesheet, script, font, and image request to documentdb.io/documentdb.github.io/... gets a 301 redirect back to the root path — an extra round trip on every asset of every page view, and the preloaded font is re-requested past the redirect.
  • After any client-side navigation, the address bar shows documentdb.io/documentdb.github.io/ai-style URLs, which is what users copy and share.
$ curl -s -o /dev/null -w "%{http_code} %{redirect_url}" https://documentdb.io/documentdb.github.io/docs
301 https://documentdb.io/docs

Fix

Drop NEXT_BASE_PATH and pin JEKYLL_BASE_PATH to /blogs, so generated URLs match where GitHub Pages actually serves the files. A comment in the workflow documents why this repo must not set a base path, to keep the project-pages trick from being reintroduced.

Existing indexed/shared /documentdb.github.io/... URLs keep working — GitHub Pages already 301s them to the root equivalents (that redirect is what made the current site navigable at all).

Validation

  • Workflow YAML parsed locally; the build step env is now exactly {JEKYLL_BASE_PATH: /blogs}.
  • The build-validation CI job already builds without NEXT_BASE_PATH, so CI on this PR exercises exactly the configuration production will now ship (previously CI validated a different configuration than the deploy used).
  • app/services/sitePath.ts and next.config.ts both handle the unset case explicitly (empty base path).

🤖 Generated with Claude Code

https://claude.ai/code/session_01XGMeNSmhAgmqzkdc7cQQgf

This repository is the organization Pages site with a custom domain, so
the deployed artifact is served at the root of documentdb.io. Building
with NEXT_BASE_PATH set to the repository name prefixes every internal
link and asset URL with /documentdb.github.io/, which GitHub Pages then
301-redirects back to the root on every request: every CSS/JS/font/image
load pays an extra round trip (defeating the font preload), and after
any client-side navigation the prefixed URL is what users see and share
in the address bar.

Drop NEXT_BASE_PATH and pin JEKYLL_BASE_PATH to /blogs so generated
URLs match where GitHub Pages actually serves the files. This also
makes the CI build-validation job (which already builds without
NEXT_BASE_PATH) exercise the same configuration that production ships.
@guanzhousongmicrosoft
guanzhousongmicrosoft merged commit 0901812 into documentdb:main Jul 30, 2026
2 checks passed
@GuanzhouSong
GuanzhouSong deleted the fix/serve-site-at-domain-root branch July 30, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants