diff --git a/README.md b/README.md index 8440d35d..0776fc51 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,35 @@ A collection of examples and demos for people building the web with Netlify -- Serverless functions, hello world — [Site](https://example-functions-hello-world.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/serverless/functions-hello-world) -- Edge Functions Examples — [Site](https://edge-functions-examples.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/edge-functions) -- Astro with Sanity - [Site](https://example-astro-sanity.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/frameworks/astro-with-sanity) +- AI Executive Summaries - [Site](https://example-ai-executive-summaries.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/ai-executive-summaries) +- AI Form Analyzer - [Code](https://github.com/netlify/examples/tree/main/examples/ai-form-analyzer) +- AI RAG Application - [Code](https://github.com/netlify/examples/tree/main/examples/ai-rag) +- AI SEO Image Generator - [Code](https://github.com/netlify/examples/tree/main/examples/ai-seo-image-generator) +- AI Speech to Content with Groq - [Code](https://github.com/netlify/examples/tree/main/examples/ai-speech-to-content) +- Astro platform starter - [Site](https://compose-astro-demo.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/compose-astro-platform-demo) +- Astro Server Islands - [Site](https://example-astro-server-islands.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/frameworks/astro-server-islands) +- Astro with Motion - [Site](https://example-astro-motion.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/frameworks/astro-with-motion) +- Astro with Netlify Visual Editor - [Site](https://example-astro-visual-editor.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/frameworks/astro-with-visual-editor) - Astro with Qwik - [Site](https://example-astro-qwik.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/frameworks/astro-with-qwik) - +- Astro with Sanity - [Site](https://example-astro-sanity.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/frameworks/astro-with-sanity) +- Block AI bots - [Site](https://example-disallow-ai-bots.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/ai-bot-control) +- Client side auth with Clerk - [Code](https://github.com/netlify/examples/tree/main/examples/auth/clerk-js) +- Edge Functions Examples — [Site](https://edge-functions-examples.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/edge-functions) +- Gated content with Clerk - [Code](https://github.com/netlify/examples/tree/main/examples/auth/clerk-gated-page) +- Geosimcities: GeoCities with Advanced AI and Langbase - [Site](https://geosimcities.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/geosimcities) +- Hydrogen storefront with advanced caching - [Site](https://example-hydrogen-caching.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/frameworks/hydrogen-caching) +- MCP with Express - [Site](https://mcp-example-express.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/mcp/express-mcp) +- MCP with Hono - [Site](https://mcp-example-hono.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/mcp/hono-mcp) +- MCP with Netlify serverless functions - [Site](https://mcp-example-serverless.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/mcp/serverless-mcp) +- Netlify DB Book Tracker - [Code](https://github.com/netlify/examples/tree/main/examples/netlify-neon-books) +- Nuxt 4 with advanced caching - [Site](https://example-nuxt-4-caching.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/frameworks/nuxt-4-caching) +- Nuxt AI chat starter - [Site](https://example-nuxt-chat.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/frameworks/nuxt-chat) +- Prerender Extension Demo - [Code](https://github.com/netlify/examples/tree/main/examples/prerender-extension) +- Serverless functions, hello world — [Site](https://example-functions-hello-world.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/serverless/functions-hello-world) +- Supabase with Astro - [Site](https://supabase-astro-example.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/supabase-astro) +- Triple Buzzer (AI Model Comparison Game) - [Site](https://triple-buzzer.netlify.app), [Code](https://github.com/netlify/examples/tree/main/examples/triple-buzzer) +- Turso with Astro - [Site](https://turso-astro.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/turso-astro) +- User-generated uploads - [Site](https://example-user-uploads-astro-blobs.netlify.app/), [Code](https://github.com/netlify/examples/tree/main/examples/user-image-uploads-astro-blobs) ## Repo organization diff --git a/boilerplates/README_template.md b/boilerplates/README_template.md index 071f63e4..72b09e0d 100644 --- a/boilerplates/README_template.md +++ b/boilerplates/README_template.md @@ -1,8 +1,8 @@ -[View this example site here]:https://example-SOME_EXAMPLE.netlify.app/ -[This example site is accompanied by a guide in the Netlify developer hub]:https://developers.netlify.com/ -[Deploy to Netlify]:https://app.netlify.com/start/deploy?repository=https://github.com/netlify/examples/&create_from_path=PATH-TO-EXAMPLE-IN-REPO&utm_campaign=dx-examples +[View this example site here]: https://example-SOME_EXAMPLE.netlify.app/ +[This example site is accompanied by a guide in the Netlify developer hub]: https://developers.netlify.com/ +[Deploy to Netlify]: https://app.netlify.com/start/deploy?repository=https://github.com/netlify/examples/&create_from_path=PATH-TO-EXAMPLE-IN-REPO&utm_campaign=dx-examples  @@ -11,7 +11,6 @@ - [View this example site here] - [This example site is accompanied by a guide in the Netlify developer hub] - ## Clone and deploy this example Deploy your own version of this example site, by clicking the button below. This will automatically: @@ -23,8 +22,6 @@ Deploy your own version of this example site, by clicking the button below. This [][Deploy to Netlify] - ## More examples -Explore other examples of using the Netlify platform and primitives, with or without a frameworks in this [examples repo](https://github.com/netlify/examples) - +Explore other examples of using the Netlify platform and primitives (with or without a framework) in this [examples repo](https://github.com/netlify/examples). diff --git a/examples/ai-bot-control/README.md b/examples/ai-bot-control/README.md index a75d4efd..7a814603 100644 --- a/examples/ai-bot-control/README.md +++ b/examples/ai-bot-control/README.md @@ -1,14 +1,15 @@ -[View this example site here]:https://example-disallow-ai-bots.netlify.app/ -[This example site is accompanied by a guide in the Netlify developer hub]:https://developers.netlify.com/ -[Deploy to Netlify]:https://app.netlify.com/start/deploy?repository=https://github.com/netlify/examples/&create_from_path=examples/ai-bot-control&utm_campaign=dx-examples +[View this example site here]: https://example-disallow-ai-bots.netlify.app/ +[This example site is accompanied by a guide in the Netlify developer hub]: https://developers.netlify.com/guides/blocking-ai-bots-and-controlling-crawlers/ +[Deploy to Netlify]: https://app.netlify.com/start/deploy?repository=https://github.com/netlify/examples/&create_from_path=examples/ai-bot-control&utm_campaign=dx-examples  # Disallowed AI bots example - [View this example site here] +- [This example site is accompanied by a guide in the Netlify developer hub] This example prevents AI bots from crawling your site content by populating a robots.txt file and also, since not all bots play nicely, filtering requests using an Edge Function. @@ -23,8 +24,6 @@ Deploy your own version of this example site, by clicking the button below. This [][Deploy to Netlify] - ## More examples -Explore other examples of using the Netlify platform and primitives, with or without a frameworks in this [examples repo](https://github.com/netlify/examples) - +Explore other examples of using the Netlify platform and primitives (with or without a framework) in this [examples repo](https://github.com/netlify/examples). diff --git a/examples/ai-bot-control/build.js b/examples/ai-bot-control/build.js index 059ef3e2..3738295c 100644 --- a/examples/ai-bot-control/build.js +++ b/examples/ai-bot-control/build.js @@ -7,7 +7,7 @@ */ // We'll be writing a file, so we'll need this. -const fs = require('node:fs'); +const fs = require('fs'); // Source a list of know User Agent strings used by AI crawlers. diff --git a/examples/ai-bot-control/netlify.toml b/examples/ai-bot-control/netlify.toml index fbeea783..baaf561b 100644 --- a/examples/ai-bot-control/netlify.toml +++ b/examples/ai-bot-control/netlify.toml @@ -1,5 +1,5 @@ [build] publish = "www" - command = "npm run build" + command = "pnpm run build" ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ." diff --git a/examples/ai-bot-control/netlify/edge-functions/bots.js b/examples/ai-bot-control/netlify/edge-functions/bots.ts similarity index 54% rename from examples/ai-bot-control/netlify/edge-functions/bots.js rename to examples/ai-bot-control/netlify/edge-functions/bots.ts index 950c6741..fa6d7db4 100644 --- a/examples/ai-bot-control/netlify/edge-functions/bots.js +++ b/examples/ai-bot-control/netlify/edge-functions/bots.ts @@ -1,17 +1,21 @@ -// Source a list of know User Agent strings used by AI crawlers. -const agents = require('../../agents.json'); +import { Context, Config } from "@netlify/edge-functions"; +import agents from "../../agents.json" with { type: "json" }; - -export default async (request, context) => { +export default async (request: Request, context: Context) => { const ua = request.headers.get('user-agent'); let isBot = false; - agents.forEach(u => { if (ua.toLowerCase().includes(u.toLowerCase())) { isBot = true; } }) - const response = isBot ? new Response(null, { status: 401 }) : await context.next(); return response; -}; \ No newline at end of file +}; + +export const config: Config = { + path: "*", +}; + + + diff --git a/examples/ai-bot-control/package.json b/examples/ai-bot-control/package.json index 8643ae0b..e6d6987a 100644 --- a/examples/ai-bot-control/package.json +++ b/examples/ai-bot-control/package.json @@ -5,5 +5,8 @@ "scripts": { "build": "node build.js" }, - "license": "ISC" + "license": "ISC", + "dependencies": { + "@netlify/edge-functions": "^2.10.0" + } } diff --git a/examples/ai-bot-control/www/index.html b/examples/ai-bot-control/www/index.html index 930e14c0..c26bf4dd 100644 --- a/examples/ai-bot-control/www/index.html +++ b/examples/ai-bot-control/www/index.html @@ -4,8 +4,86 @@
This site disallows AI crawler bots
+