Configure site for /cg-ai subdirectory deployment

- Set base path to '/cg-ai' in astro.config.mjs
- Update favicon to use metagov.png with dynamic base path
- Add deployment documentation for subdirectory configuration
- Rebuild dist with correct asset paths

CSS and other assets will now load correctly when deployed
to example.com/cg-ai/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Nathan Schneider
2025-11-18 15:07:50 -07:00
parent 61bb405f99
commit 5899006717
3 changed files with 26 additions and 4 deletions

View File

@@ -99,6 +99,22 @@ You can extend the JavaScript in the `<script>` tag for additional interactivity
## Deployment
### Configuring the Base Path
If deploying to a subdirectory (e.g., `example.com/my-site/`), update `astro.config.mjs`:
```javascript
export default defineConfig({
base: '/my-site', // Change to your subdirectory path
});
```
For root deployment (`example.com/`), remove the `base` option or set it to `'/'`.
**Current configuration**: This site is configured for `/cg-ai` subdirectory.
### Building and Deploying
1. **Build the site**:
```bash
npm run build
@@ -109,9 +125,13 @@ You can extend the JavaScript in the `<script>` tag for additional interactivity
- **Netlify**: Drag and drop `dist/` to [netlify.com/drop](https://app.netlify.com/drop)
- **GitHub Pages**: Push `dist/` contents to gh-pages branch
- **Vercel**: Run `vercel` CLI in project root
- **Any static host**: Upload `dist/` folder via FTP/SFTP
- **Any static host**: Upload `dist/` folder via FTP/SFTP to your web directory
Note: Deploy the `dist/` folder, not `public/`. The `public/` folder contains source assets that get copied into the build.
3. **Important**: Deploy the `dist/` folder contents to match your base path:
- If `base: '/cg-ai'`, upload dist contents to `public_html/cg-ai/` on your server
- If `base: '/'`, upload dist contents to `public_html/` (or your web root)
Note: The `public/` folder contains source assets, not the production build. Always deploy `dist/`.
## Troubleshooting

View File

@@ -2,4 +2,6 @@
import { defineConfig } from 'astro/config';
// https://astro.build/config
export default defineConfig({});
export default defineConfig({
base: '/cg-ai',
});

View File

@@ -26,7 +26,7 @@ const parsedSections = sections.map(section => {
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/png" href={`${import.meta.env.BASE_URL}/metagov.png`} />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>Digital Zine</title>