Skip to content

Commit 928cb49

Browse files
Merge pull request #46 from ThomasJButler/v3.5---Fix-to-sort-project-root.-
V3.5-fix-project-root
2 parents 3371906 + a602e95 commit 928cb49

File tree

3 files changed

+355
-1879
lines changed

3 files changed

+355
-1879
lines changed

.DS_Store

0 Bytes
Binary file not shown.

claude.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# GitHub Pages Root Domain Migration Plan
2+
3+
## Problem Statement
4+
Currently, the website is deployed at `https://thomasjbutler.github.io/ThomasJButler` with the repository name appearing twice in the URL. The goal is to migrate to `https://thomasjbutler.github.io` (root domain).
5+
6+
## Solution Overview
7+
To achieve this, the repository needs to be renamed to match the GitHub username exactly (thomasjbutler.github.io), and all base path references need to be removed from the codebase.
8+
9+
## Critical Changes Required
10+
11+
### 1. GitHub Repository Configuration
12+
**Action**: Rename repository from `ThomasJButler` to `thomasjbutler.github.io`
13+
- This is the ONLY way to get GitHub Pages to serve at the root domain
14+
- GitHub Pages rule: `username.github.io` repositories are served at root
15+
- All other repositories are served at `/repository-name/`
16+
17+
### 2. Package.json ([package.json](package.json))
18+
**Current**:
19+
```json
20+
"homepage": "https://thomasjbutler.github.io/ThomasJButler"
21+
```
22+
**Change to**:
23+
```json
24+
"homepage": "https://thomasjbutler.github.io"
25+
```
26+
27+
### 3. Vite Configuration ([vite.config.mjs](vite.config.mjs))
28+
**Line 9 - Remove base path**:
29+
```javascript
30+
// Current:
31+
base: '/ThomasJButler/',
32+
// Change to:
33+
base: '/',
34+
```
35+
36+
**Lines 46-49 & 73-89 - Update middleware paths**:
37+
Remove `/ThomasJButler` prefix from all middleware URL checks
38+
39+
**Line 122 - Update dev server open path**:
40+
```javascript
41+
// Current:
42+
open: '/ThomasJButler/react.html',
43+
// Change to:
44+
open: '/react.html',
45+
```
46+
47+
### 4. React Router Configuration ([src/App.tsx](src/App.tsx))
48+
**Line 102 - Remove basename**:
49+
```javascript
50+
// Current:
51+
<Router basename="/ThomasJButler">
52+
// Change to:
53+
<Router>
54+
```
55+
56+
### 5. Blog Loader Utility ([src/utils/blogLoader.ts](src/utils/blogLoader.ts))
57+
**Lines 134 - Update production base path**:
58+
```javascript
59+
// Current:
60+
return '/ThomasJButler';
61+
// Change to:
62+
return '';
63+
```
64+
65+
### 6. HTML Files
66+
Update all HTML files that contain `/ThomasJButler` references:
67+
- [index.html](index.html)
68+
- [react.html](react.html)
69+
- [blog.html](blog.html)
70+
71+
### 7. Other Files with Path References
72+
Update the following files to remove `/ThomasJButler` prefix:
73+
- [src/components/Header.tsx](src/components/Header.tsx)
74+
- [src/components/Footer.tsx](src/components/Footer.tsx)
75+
- [src/pages/SitemapPage.tsx](src/pages/SitemapPage.tsx)
76+
- [src/pages/ProjectsPage.tsx](src/pages/ProjectsPage.tsx)
77+
- [src/utils/timelineData.ts](src/utils/timelineData.ts)
78+
- [public/manifest.json](public/manifest.json)
79+
80+
### 8. Test Files
81+
Update test files that reference the base path:
82+
- [src/__tests__/App.test.tsx](src/__tests__/App.test.tsx)
83+
- [src/__tests__/migration-validation.test.tsx](src/__tests__/migration-validation.test.tsx)
84+
- [src/pages/__tests__/SitemapPage.test.tsx](src/pages/__tests__/SitemapPage.test.tsx)
85+
86+
## Implementation Order
87+
88+
1. **First**: Update all code files (steps 2-8)
89+
2. **Build & Test**: Run `npm run build` locally to ensure everything works
90+
3. **Commit**: Commit all changes to the repository
91+
4. **Rename Repository**: Go to GitHub Settings > General > Repository name
92+
- Change from `ThomasJButler` to `thomasjbutler.github.io`
93+
5. **Wait**: GitHub Pages will automatically redeploy at the root domain
94+
95+
## Important Notes
96+
97+
- **Repository Name Must Match**: The repository MUST be named `thomasjbutler.github.io` (lowercase) to work at root domain
98+
- **Automatic Redirect**: GitHub will automatically redirect the old URL to the new one
99+
- **DNS Propagation**: Changes may take 10-20 minutes to fully propagate
100+
- **Local Development**: Will continue to work normally at `localhost:3000`
101+
- **No CNAME Needed**: Since using github.io domain, no CNAME file is required
102+
103+
## Verification Steps
104+
105+
After deployment:
106+
1. Visit `https://thomasjbutler.github.io` - should load the site
107+
2. Check all internal navigation works correctly
108+
3. Verify blog posts load properly
109+
4. Test that old URL redirects to new one
110+
5. Check browser console for any 404 errors
111+
112+
## Rollback Plan
113+
114+
If issues occur:
115+
1. Rename repository back to `ThomasJButler`
116+
2. Revert the code changes via git
117+
3. Push to trigger redeployment
118+
119+
This approach ensures a clean URL structure while maintaining all functionality.

0 commit comments

Comments
 (0)