MODULE 097 lessons~55 min

🚀 Deployment System.

Deploy to Cloudflare Pages, connect custom domains, set up the no-index safeguard, and submit to search engines.

9.1

Cloudflare Pages vs Workers.

Cloudflare Pages is for static sites (HTML/CSS/JS only). Cloudflare Workers supports server-side logic. For micro-tools built with AstroJS (static output), Pages is the better choice — simpler setup, free tier, and optimized for static content.

9.2

Wrangler CLI setup and login.

Wrangler is Cloudflare's command-line tool for deploying. Install it and authenticate with your Cloudflare account.

# Install Wrangler npm install wrangler@latest --save-dev # Login to Cloudflare npx wrangler login # Browser opens → authorize → done
9.3

First deployment to pages.dev.

Tell your AI to deploy the site to Cloudflare Pages. It will configure the build and deploy automatically. You'll get a temporary URL like project-name.pages.dev for testing.

# Deploy command (add to package.json scripts) "deploy": "npx wrangler pages deploy ./dist" # Run deployment npm run deploy
9.4

Custom domain connection.

Go to Cloudflare dashboard → your Pages project → Custom Domains → add your purchased domain. You'll need to update your domain's nameservers to Cloudflare's nameservers. Also add the www variant.

Pro tip: Set up both root domain (yourdomain.com) and www subdomain (www.yourdomain.com). Nameserver propagation takes 10 minutes to 24 hours.
9.5

The "no-index" safeguard for duplicate content.

Your site is live on both your custom domain AND the pages.dev subdomain. This creates a duplicate content risk. Fix it by adding a _headers file that tells Google to ignore the pages.dev URL.

# Create /public/_headers file: https://your-project.pages.dev/* X-Robots-Tag: noindex # WARNING: Use only the main pages.dev URL # Do NOT use versioned URLs like abc123.pages.dev
9.6

Google Search Console setup.

Go to search.google.com/search-console, add your domain, verify via DNS TXT record in Cloudflare, submit your sitemap, and request indexing for your homepage. Data starts appearing within 2-3 days.

9.7

Bing Webmaster Tools import.

Go to bing.com/webmasters, sign in with Google, and use the one-click import from Google Search Console. This doubles your search presence with zero additional effort. Submit your URL for indexing.