Skip to content

Commit ce45064

Browse files
Fix GitHub Pages deployment: resolve CSS and images not loading issue (#20)
2 parents 5cd761c + af30725 commit ce45064

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,20 @@ jobs:
4141
run: npm run build:github-pages
4242

4343
- name: Add .nojekyll file
44-
run: touch out/.nojekyll
44+
run: |
45+
echo "Creating .nojekyll file to disable Jekyll processing"
46+
touch out/.nojekyll
47+
echo "Verifying .nojekyll file was created:"
48+
ls -la out/.nojekyll
49+
50+
- name: Debug build output
51+
run: |
52+
echo "Build output structure:"
53+
ls -la out/
54+
echo "Checking _next directory:"
55+
ls -la out/_next/
56+
echo "Checking static assets:"
57+
ls -la out/_next/static/chunks/ | head -5
4558
4659
- name: Upload artifact
4760
uses: actions/upload-pages-artifact@v3

docs/github-pages-deployment.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,20 @@ const nextConfig: NextConfig = {
3434
};
3535
```
3636

37-
### 2. GitHub Actions Workflow (`.github/workflows/deploy-github-pages.yml`)
37+
### 2. GitHub Actions Workflow (`.github/workflows/deploy.yml`)
3838

3939
Automated deployment workflow that:
40-
- Triggers on pushes to `main` branch
40+
- Triggers on pushes to `main` branch and pull requests
4141
- Can be manually triggered via workflow_dispatch
42-
- Builds the Next.js application as static files
43-
- Deploys to GitHub Pages
42+
- Builds the Next.js application as static files using `npm run build:github-pages`
43+
- Creates `.nojekyll` file to disable Jekyll processing
44+
- Deploys to GitHub Pages using official GitHub Pages action
4445

45-
### 3. Additional Files
46+
### 3. Critical Files for Deployment
4647

47-
- `.nojekyll`: Prevents GitHub from processing the site with Jekyll
48-
- `404.html`: Custom 404 page (automatically generated by Next.js)
48+
- **`.nojekyll`**: Automatically created during build to prevent GitHub from processing the site with Jekyll (critical for `_next` directory assets)
49+
- **`404.html`**: Custom 404 page (automatically generated by Next.js)
50+
- **Asset files**: All CSS/JS files in `_next/static/` directory with correct basePath prefixes
4951

5052
## Deployment Process
5153

0 commit comments

Comments
 (0)