Skip to content

Commit cd35939

Browse files
feat(infra): add Netlify Image CDN and reduce web requests
Integrate @astrojs/netlify adapter with imageCDN enabled so all raster images are optimized at the edge (AVIF/WebP format negotiation, resizing) instead of at build time — zero code changes needed across existing <Image> and getImage() usage. Add robots.txt to block aggressive AI scrapers (GPTBot, Bytespider, SemrushBot, etc.) and set crawl delays for legitimate search engines. Add Cache-Control headers for HTML pages (1h TTL + stale-while-revalidate) so repeat visits are served from Netlify's CDN edge cache. Defer below-fold video components from client:load to client:visible so their JS chunks only load when scrolled into view, reducing initial requests per page — especially for bots that don't scroll. - astro.config.mjs: add netlify() adapter, image.domains, remove dead vite.build.assets config - netlify.toml: replace broken image redirect rules with [images] config - public/robots.txt: block AI scrapers, crawl-delay for search engines - public/_headers: add HTML page caching with stale-while-revalidate - Audiodotcom.astro: remove format:"webp" (let CDN auto-negotiate), switch FeaturedVideo to client:visible - ReleaseVideo.astro: switch SplitFeaturedVideo x2 to client:visible - package.json: add @astrojs/netlify, remove unused @fontsource/twinkle-star Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 85d8f88 commit cd35939

16 files changed

Lines changed: 16560 additions & 175 deletions

.github/workflows/deploy.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
name: Deploy to GitHub Pages
22

33
on:
4-
# Trigger the workflow every time you push to the `main` branch
5-
# Using a different branch name? Replace `main` with your branch’s name
6-
push:
7-
branches: [ main ]
8-
# Allows you to run this workflow manually from the Actions tab on GitHub.
4+
# Manual only — Netlify is primary host
95
workflow_dispatch:
10-
6+
117
# Allow this job to clone the repo and create a page deployment
128
permissions:
139
contents: read
@@ -23,11 +19,9 @@ jobs:
2319
- name: Install, build, and upload your site
2420
uses: withastro/action@v3
2521
# with:
26-
# path: . # The root location of your Astro project inside the repository. (optional)
27-
# node-version: 16 # The specific version of Node that should be used to build your site. Defaults to 16. (optional)
28-
# package-manager: yarn # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
29-
30-
22+
# path: . # The root location of your Astro project inside the repository. (optional)
23+
# node-version: 16 # The specific version of Node that should be used to build your site. Defaults to 16. (optional)
24+
# package-manager: yarn # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
3125

3226
deploy:
3327
needs: build
@@ -38,4 +32,4 @@ jobs:
3832
steps:
3933
- name: Deploy to GitHub Pages
4034
id: deployment
41-
uses: actions/deploy-pages@v4
35+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ pnpm-debug.log*
2020
# macOS-specific files
2121
.DS_Store
2222

23-
*.code-workspace
23+
*.code-workspace
24+
# Local Netlify folder
25+
.netlify

astro.config.mjs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import { defineConfig } from "astro/config";
22
import tailwind from "@astrojs/tailwind";
33
import react from "@astrojs/react";
44
import icon from "astro-icon";
5-
65
import sitemap from "@astrojs/sitemap";
7-
8-
// https://astro.build/config
96
import compressor from "astro-compressor";
7+
import netlify from "@astrojs/netlify";
108

11-
// https://astro.build/config
129
export default defineConfig({
1310
site: "https://www.audacityteam.org",
11+
adapter: netlify({ imageCDN: true }),
12+
image: {
13+
domains: ["i.ytimg.com"],
14+
},
1415
integrations: [
1516
tailwind({
1617
// Example: Disable injecting a basic `base.css` import on every page.
@@ -36,8 +37,5 @@ export default defineConfig({
3637
"@datapunt/matomo-tracker-js",
3738
],
3839
},
39-
build: {
40-
assets: 'assets',
41-
},
4240
},
4341
});

netlify.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[build]
2+
command = "npm run build"
3+
publish = "dist"
4+
5+
# Disable redundant post-processing (Astro already handles this)
6+
[build.processing.css]
7+
bundle = false
8+
minify = false
9+
[build.processing.js]
10+
bundle = false
11+
minify = false
12+
[build.processing.images]
13+
compress = false
14+
15+
# Allow external images through Netlify Image CDN
16+
[images]
17+
remote_images = ["https://i\\.ytimg\\.com/.*"]

0 commit comments

Comments
 (0)