Skip to content

Latest commit

 

History

History
132 lines (94 loc) · 3.27 KB

File metadata and controls

132 lines (94 loc) · 3.27 KB

Environment Configuration Summary

✅ What Changed

Your site now has dynamic base URL configuration!

New Files Created:

  1. lib/config.ts - Central configuration file

    • Auto-detects environment (localhost, Netlify, production)
    • Exports siteConfig with all site settings
    • Used throughout the app for consistency
  2. .env.local - Your local environment variables

    • Currently set to: https://notelyvoicepreview.netlify.app
    • Gitignored (not committed to repo)
    • Easy to switch between environments
  3. .env.local.example - Template for others

    • Shows all available environment variables
    • Committed to repo for reference
  4. BASE_URL_GUIDE.md - Complete documentation

Updated Files:

  • app/layout.tsx - Uses siteConfig.url
  • app/sitemap.ts - Uses siteConfig.url
  • app/robots.ts - Uses siteConfig.url
  • lib/seo.ts - Imports from config

🚀 How to Use

For Local Testing:

# Edit .env.local
NEXT_PUBLIC_SITE_URL=http://localhost:3000

# Restart server
npm run dev

For Netlify Preview (Current):

# Edit .env.local (already set!)
NEXT_PUBLIC_SITE_URL=https://notelyvoicepreview.netlify.app

# Build
npm run build

For Production:

# Edit .env.local
NEXT_PUBLIC_SITE_URL=https://notelyvoice.com

# Build and deploy
npm run build

🎯 Quick Test

To verify your current URL:

  1. Start dev server: npm run dev
  2. Open: http://localhost:3000/sitemap.xml
  3. You should see: https://notelyvoicepreview.netlify.app in all URLs

To switch to localhost:

  1. Edit .env.local: Change to http://localhost:3000
  2. Restart: Ctrl+C then npm run dev
  3. Check sitemap again - URLs should now show localhost

📊 What This Fixes

Before:

  • All URLs hardcoded to https://notelyvoice.com
  • Had to manually find/replace in multiple files
  • Easy to miss files when switching environments

After:

  • One place to change: .env.local
  • All SEO features automatically use correct URL
  • Auto-detection for deployment platforms

🔍 Files Using the Config

The base URL is now used in:

  1. Sitemap (/sitemap.xml)

    • All page URLs use correct domain
  2. Robots.txt (/robots.txt)

    • Sitemap URL is dynamic
  3. Page Metadata (all pages)

    • Canonical URLs
    • Open Graph URLs
    • Twitter Card data
  4. Structured Data (JSON-LD schemas)

    • Organization schema
    • Website schema
    • Software application schema

⚠️ Important Notes

  • Must restart dev server after changing .env.local
  • .env.local is gitignored - each developer sets their own
  • For Netlify production, set environment variable in dashboard
  • Changes take effect immediately after restart

🎉 You're All Set!

Your current setup:

  • ✅ Preview URL configured: https://notelyvoicepreview.netlify.app
  • ✅ Easy switching between environments
  • ✅ All SEO features use correct URL
  • ✅ Ready for localhost testing
  • ✅ Ready for production deployment

Just edit .env.local when you need to switch environments!


Next Steps:

  1. Test locally: Change to http://localhost:3000 and verify
  2. When ready for production: Change to https://notelyvoice.com
  3. Update Netlify environment variables for production deploy

Read BASE_URL_GUIDE.md for detailed instructions!