Skip to content

feat(pages): serve landing site at custom-domain root with clean URLs#407

Merged
lizhengfeng101 merged 1 commit into
mainfrom
feat/pages-root-domain-clean-urls
Jul 20, 2026
Merged

feat(pages): serve landing site at custom-domain root with clean URLs#407
lizhengfeng101 merged 1 commit into
mainfrom
feat/pages-root-domain-clean-urls

Conversation

@lizhengfeng101

Copy link
Copy Markdown
Collaborator

What

Prepares the landing site (pages/) to be served at the root of the open-codereview.ai custom domain and drops the /#/ from URLs.

  • webpack.config.js: publicPath/ so assets load at the domain root (previously hard-coded to the /open-code-review/ GitHub Pages subpath). Adds a second HtmlWebpackPlugin that emits 404.html (a copy of index.html) as an SPA deep-link fallback.
  • src/index.tsx: HashRouterBrowserRouter for clean paths (e.g. /docs instead of /#/docs).
  • src/components/HeroSection.tsx: replace the hard-coded href="#/docs" anchor with a router <Link to="/docs"> (the in-page #quickstart anchor is intentionally kept).
  • public/CNAME: add open-codereview.ai so GitHub Pages serves the site at the custom-domain root.

Why

The site is moving from alibaba.github.io/open-code-review/ to the short custom domain open-codereview.ai. Serving at a subpath forces the ugly /open-code-review/ asset prefix and the HashRouter /#/ URLs. This change makes the build target the domain root and produces clean, shareable URLs.

Release note ⚠️

Merging this to main triggers the Pages deploy, which activates the CNAME and makes GitHub Pages claim open-codereview.ai (and redirect the old subpath). This must be merged in coordination with the DNS cutover — if DNS is not yet pointing the domain at GitHub Pages, the site will be unreachable until it is.

Client-side routing (BrowserRouter) relies on the 404.html fallback on plain GitHub Pages; once the site moves behind a CDN, the fallback should be handled by the CDN (404 → index.html, HTTP 200).

Verification

  • npm run build succeeds; dist/index.html references assets at root (/bundle.js), dist/404.html matches index.html, and dist/CNAME contains open-codereview.ai.
  • ocr review on the diff: 0 comments.

Migrate the landing site from the GitHub Pages subpath
/open-code-review/ to the root of the open-codereview.ai custom domain
and drop the /#/ from URLs:

- webpack publicPath -> '/' so assets load at the domain root
- switch HashRouter -> BrowserRouter for clean paths (e.g. /docs)
- fix HeroSection '#/docs' anchor to a router Link
- add public/CNAME (open-codereview.ai) for the GitHub Pages custom domain
- emit 404.html (copy of index.html) as SPA deep-link fallback
@lizhengfeng101
lizhengfeng101 requested a review from xyJen July 20, 2026 08:04
@github-actions

Copy link
Copy Markdown
Contributor

OpenCodeReview: No comments generated. Looks good to me.

@xyJen xyJen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@lizhengfeng101
lizhengfeng101 merged commit 750304d into main Jul 20, 2026
7 checks passed
@lizhengfeng101
lizhengfeng101 deleted the feat/pages-root-domain-clean-urls branch July 20, 2026 08:12
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