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:
24
README.md
24
README.md
@@ -99,6 +99,22 @@ You can extend the JavaScript in the `<script>` tag for additional interactivity
|
|||||||
|
|
||||||
## Deployment
|
## 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**:
|
1. **Build the site**:
|
||||||
```bash
|
```bash
|
||||||
npm run build
|
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)
|
- **Netlify**: Drag and drop `dist/` to [netlify.com/drop](https://app.netlify.com/drop)
|
||||||
- **GitHub Pages**: Push `dist/` contents to gh-pages branch
|
- **GitHub Pages**: Push `dist/` contents to gh-pages branch
|
||||||
- **Vercel**: Run `vercel` CLI in project root
|
- **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
|
## Troubleshooting
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,6 @@
|
|||||||
import { defineConfig } from 'astro/config';
|
import { defineConfig } from 'astro/config';
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({});
|
export default defineConfig({
|
||||||
|
base: '/cg-ai',
|
||||||
|
});
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const parsedSections = sections.map(section => {
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<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="viewport" content="width=device-width" />
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
<title>Digital Zine</title>
|
<title>Digital Zine</title>
|
||||||
|
|||||||
Reference in New Issue
Block a user