AI Website Tag Generator
Generate topic tags for any website using Workers AI on the edge
This is an experimental Worker. Use it as a starting point for your own projects.
The AI Website Tag Generator experiment fetches any webpage, extracts its content, and uses Workers AI to generate topic tags. Built with Hono and TypeScript, it runs on Cloudflare's edge network-no external API keys required.
Features
- Fetch and parse any public webpage
- Extract title and body text from HTML
- Generate topic tags using Workers AI (e.g. Llama 3.1)
- Sub-second responses on the edge
- Accepts full URLs or hostnames (e.g.
https://cloudflare.comorexample.com)
API Reference
GET /tags
Generate topic tags for any webpage.
Prop
Type
Response
tags string[]
An array of topic tags generated from the page content.
Example Request
curl "https://your-worker.workers.dev/tags?url=https://www.cloudflare.com"Example Response
{
"tags": ["technology", "CDN", "security", "edge computing", "DDoS protection"]
}Error Responses
error string
Human-readable error message.
code string
Machine-readable error code.
400 Bad Request - Missing or invalid URL:
{
"error": "Missing or invalid query parameter: url",
"code": "INVALID_URL"
}502 Bad Gateway - Failed to fetch webpage or AI error:
{
"error": "Failed to fetch or generate tags",
"code": "FETCH_OR_AI_ERROR"
}Use Cases
- Content tagging - Auto-tag articles or bookmarks by topic
- SEO and discovery - Suggest categories or related topics from page content
- Link previews - Enrich shared links with topic tags
- Research and curation - Quickly label pages by theme
Limitations
- JavaScript-heavy sites - Only static HTML is fetched; client-rendered content is not executed
- Workers AI limits - Subject to Workers AI usage limits by plan
- Fetch and size limits - Same constraints as other URL-based experiments (timeout, HTML size cap)
Deployment
Deploy
Enable the Workers AI binding (AI) in your Worker settings. The deploy button configures this automatically via wrangler.json. Requires a Cloudflare account with Workers AI enabled.
Test your deployment
curl "https://your-worker.workers.dev/tags?url=https://www.cloudflare.com"Local Development
cd apps/experiments/ai-website-tag-generator
npm install
npm run devTest locally:
curl "http://localhost:8787/tags?url=https://www.cloudflare.com"Cloudflare Features Used
- Workers - Serverless execution environment
- Workers AI - Run LLMs on the edge with the
AIbinding - Fetch API - HTTP client for fetching webpages