# SEO Manager Setup & Troubleshooting Guide

## Quick Start

The SEO Manager requires a **local web server** to function properly. It cannot work when files are opened directly with `file://` protocol.

### Windows Users

**Easy Method - Use the Batch Script:**

1. Double-click `start-server.bat` in the website folder
2. Wait for the message "Server is running!"
3. Open your browser and go to: `http://localhost:8000`
4. Click "SEO Manager" in the navigation menu

**Manual Method - Command Prompt:**

```cmd
# Navigate to your website folder
cd "C:\Users\mdownham\MDR Website"

# Start Python's built-in HTTP server
python -m http.server 8000
```

Then open: `http://localhost:8000/seo-manager.html`

---

### Mac Users

**Easy Method - Use the Shell Script:**

1. Open Terminal
2. Navigate to your website folder:
   ```bash
   cd ~/path/to/MDR\ Website
   ```
3. Run the startup script:
   ```bash
   chmod +x start-server.sh
   ./start-server.sh
   ```
4. Open your browser and go to: `http://localhost:8000`
5. Click "SEO Manager" in the navigation menu

**Manual Method:**

```bash
# Navigate to website folder
cd ~/path/to/MDR\ Website

# Start Python's HTTP server
python3 -m http.server 8000
```

---

### Linux Users

**Via Terminal:**

```bash
# Navigate to website folder
cd /path/to/MDR\ Website

# Start Python's HTTP server
python3 -m http.server 8000
```

Or use the provided script:
```bash
chmod +x start-server.sh
./start-server.sh
```

---

## Why Do I Need a Web Server?

The SEO Manager uses the JavaScript `fetch()` API to load and analyze your HTML pages. For security reasons, browsers block direct file access (`file://` protocol) from using `fetch()`.

**This is intentional** - it's a browser security feature called CORS (Cross-Origin Resource Sharing).

---

## What If I'm Using VS Code?

VS Code has a built-in "Live Server" extension that makes this super easy:

1. Install the "Live Server" extension (by Ritwick Dey)
2. Right-click on `index.html`
3. Select "Open with Live Server"
4. Your browser will open automatically at `http://localhost:5500`
5. Navigate to the SEO Manager from there

---

## Troubleshooting

### "Error loading page. Please try again"

**Solution 1: Start a Local Server**
- Use `start-server.bat` (Windows) or `start-server.sh` (Mac/Linux)
- Access at `http://localhost:8000`

**Solution 2: Use VS Code Live Server**
- Install the "Live Server" extension
- Right-click on `index.html` → "Open with Live Server"

**Solution 3: Check the Browser Console**
- Press `F12` to open Developer Tools
- Click "Console" tab
- Look for error messages
- Screenshot these errors if asking for help

### "Module not found" or Path Errors

This means the file paths are incorrect. Make sure:
1. All HTML files exist in their correct locations
2. You're accessing the site via `http://` not `file://`
3. The directory structure matches:
   ```
   MDR Website/
   ├── index.html
   ├── seo-manager.html
   ├── pages/
   │   ├── about.html
   │   ├── services.html
   │   └── contact.html
   └── assets/
   ```

### Python Not Installed or Not in PATH

**Windows:**
1. Download Python from https://www.python.org/downloads/
2. During installation, **check "Add Python to PATH"**
3. Click "Install Now"
4. Restart your terminal/command prompt
5. Try again

**Mac:**
```bash
# Install via Homebrew
brew install python3
```

**Linux:**
```bash
# Ubuntu/Debian
sudo apt-get install python3

# Fedora
sudo dnf install python3
```

---

## SEO Manager Features

Once the server is running correctly, the SEO Manager provides:

✅ **Individual Page Analysis**
- SEO score (0-100)
- Title, description, keywords analysis
- Heading structure verification
- Image alt text checking
- Internal link analysis

✅ **All-Pages Overview**
- Compare SEO scores across all pages
- Quick metric comparison
- Identify which pages need work

✅ **Smart Recommendations**
- Critical issues (red)
- Warnings (yellow)
- Success messages (green)

✅ **Export Reports**
- Download SEO analysis as text file
- Share with team members

---

## Tips for Best Results

1. **Always use a web server** - Never open files directly with `file://`
2. **Keep server running** - It must be active while using SEO Manager
3. **Check console for errors** - Press F12 → Console to see detailed logs
4. **Analyze all pages** - Get a full picture of your site's SEO health
5. **Review recommendations** - Fix critical issues first

---

## Still Having Issues?

1. **Check the browser console** (F12 → Console)
2. **Copy any error messages**
3. **Make sure the server is running** (you should see output in the terminal)
4. **Verify file paths** are correct in your directory structure
5. **Try a different browser** (Chrome, Firefox, Edge)

---

## Port Already in Use?

If port 8000 is already in use, try a different port:

```cmd
# Use port 8080 instead
python -m http.server 8080
```

Then access at: `http://localhost:8080`

---

Enjoy your SEO Manager! 🚀
