You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project uses a **Multi-Entry SPA** architecture to ensure perfect compatibility with GitHub Pages, Google AdSense, and SEO crawlers.
111
+
112
+
### The Problem it Solves
113
+
GitHub Pages is a static host. By default, visiting a deep link like `/Free-Tools/word-counter` returns a **404 Not Found** because that physical file doesn't exist. This breaks AdSense (which requires HTTP 200 OK) and hurts SEO.
114
+
115
+
### The Solution: Multi-Entry SPA
116
+
During the build process (`npm run build`), we programmatically generate physical directories and `index.html` files for every route:
117
+
118
+
```text
119
+
dist/
120
+
├── index.html (Root entry point)
121
+
├── .nojekyll (Prevents Jekyll processing)
122
+
├── 404.html (Smart fallback for typos)
123
+
├── word-counter/
124
+
│ └── index.html (Copy of main index.html)
125
+
└── ...
126
+
```
127
+
128
+
When a user requests `/Free-Tools/word-counter`, GitHub Pages serves the physical file at `dist/word-counter/index.html` with **HTTP 200 OK**.
129
+
130
+
### 🛠️ Automated Workflow
131
+
132
+
We have automated the entire process to prevent errors:
133
+
134
+
1.**`npm run validate-routes`**: Checks that every route defined in `src/App.jsx` matches the routes in `generate-sitemap.js`. Runs automatically before build.
135
+
2.**`node generate-sitemap.js`**:
136
+
* Generates `sitemap.xml`.
137
+
* Creates the physical folder structure in `dist/`.
138
+
* Creates `.nojekyll` and `404.html`.
139
+
3.**Use `npm run prepare-deploy`**: Runs the full sequence: Validate → Build → Generate.
140
+
141
+
### ➕ Adding a New Tool
142
+
143
+
1. Add the route in `src/App.jsx`.
144
+
2. Add the route to the `routes` array in `generate-sitemap.js`.
145
+
3. Run `npm run validate-routes` to verify.
146
+
147
+
---
148
+
149
+
## 📜 Implementation Summary (Dec 2025)
150
+
151
+
**Objective**: Fix 404 errors on GitHub Pages for AdSense & SEO.
152
+
153
+
**Key Changes:**
154
+
***Physical Route Generation**: `generate-sitemap.js` now creates real folders for every route.
0 commit comments