Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions seo-toolkit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
reports/
*.log
.DS_Store
sitemap.xml
robots.txt
238 changes: 238 additions & 0 deletions seo-toolkit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
# SEO Toolkit

A powerful, all-in-one SEO automation toolkit for auditing, analyzing, and optimizing websites from the command line.

## Features

| Feature | Description |
|---------|-------------|
| **Full SEO Audit** | Comprehensive analysis of meta tags, content, technical SEO, and links with scoring |
| **Keyword Analysis** | Keyword density, n-gram extraction, and target keyword placement tracking |
| **Sitemap Generator** | Crawls your site and generates a valid XML sitemap |
| **Robots.txt Generator** | Creates optimized robots.txt with AI bot blocking option |
| **Meta Tag Generator** | Produces complete meta tags including Open Graph and Twitter Cards |
| **Schema.org Generator** | Creates JSON-LD structured data for rich search results |
| **SEO Comparison** | Side-by-side comparison of two URLs |
| **HTML Reports** | Beautiful, detailed audit reports you can share |

## Installation

```bash
cd seo-toolkit
npm install

# Optional: link globally for CLI access
npm link
```

## Usage

### Full SEO Audit

Run a comprehensive audit on any URL:

```bash
# Basic audit
node src/cli.js audit https://example.com

# Audit with target keyword tracking
node src/cli.js audit https://example.com -k "seo tools,website optimization"

# Audit with broken link checking (slower but thorough)
node src/cli.js audit https://example.com --check-links

# Save HTML report
node src/cli.js audit https://example.com -o reports/audit.html

# Save JSON report
node src/cli.js audit https://example.com -o reports/audit.json

# Output raw JSON to stdout
node src/cli.js audit https://example.com --json
```

### Keyword Analysis

Analyze keyword density and placement:

```bash
# Auto-detect top keywords
node src/cli.js keywords https://example.com

# Check specific target keywords
node src/cli.js keywords https://example.com -t "seo,optimization,ranking"

# Show top 30 keywords
node src/cli.js keywords https://example.com -n 30
```

### Generate XML Sitemap

Crawl your site and produce a sitemap:

```bash
# Generate sitemap (crawls up to 50 pages)
node src/cli.js sitemap https://example.com

# Crawl up to 200 pages
node src/cli.js sitemap https://example.com -m 200

# Custom output path
node src/cli.js sitemap https://example.com -o public/sitemap.xml
```

### Generate Robots.txt

```bash
# Basic robots.txt
node src/cli.js robots

# With sitemap URL
node src/cli.js robots -s https://example.com/sitemap.xml

# Block AI crawlers
node src/cli.js robots --block-ai

# Custom disallow paths
node src/cli.js robots -d "/admin,/api,/private"

# Set crawl delay
node src/cli.js robots --delay 10
```

### Generate Meta Tags

```bash
# Generate full meta tag set
node src/cli.js meta --title "My Page Title" \
--description "A compelling description of my page" \
--url "https://example.com/page" \
--image "https://example.com/image.jpg" \
--site-name "My Website" \
--twitter "@myhandle"

# Save to file
node src/cli.js meta --title "My Page" -o meta-tags.html
```

### Generate Schema.org Structured Data

```bash
# Website schema
node src/cli.js schema website --name "My Site" --url "https://example.com"

# Organization schema
node src/cli.js schema organization --name "My Company" --url "https://example.com"

# Article schema
node src/cli.js schema article --name "Article Title" --author "John Doe"

# FAQ schema (generates template to customize)
node src/cli.js schema faq

# Local business schema
node src/cli.js schema local-business --name "My Store" --phone "+1-555-0123"
```

### Compare Two URLs

```bash
node src/cli.js compare https://example.com https://competitor.com
```

## Programmatic Usage

Use the toolkit as a library in your own Node.js projects:

```javascript
const {
runAudit,
generateSitemap,
generateRobots,
generateMetaTags,
generateWebsiteSchema,
wrapInScriptTag,
} = require('./src/index');

// Run a full audit
const results = await runAudit('https://example.com', {
targetKeywords: ['seo', 'optimization'],
checkBrokenLinks: true,
});

console.log(`Score: ${results.overall}/100 (${results.grade.grade})`);

// Generate a sitemap
const sitemap = await generateSitemap('https://example.com', { maxPages: 100 });
console.log(sitemap.xml);

// Generate meta tags
const tags = generateMetaTags({
title: 'My Page',
description: 'Description here',
url: 'https://example.com',
});

// Generate structured data
const schema = generateWebsiteSchema({ name: 'My Site', url: 'https://example.com' });
const scriptTag = wrapInScriptTag(schema);
```

## What Gets Checked

### Meta Analysis
- Title tag (length, presence)
- Meta description (length, presence)
- Canonical URL
- Viewport tag
- Charset declaration
- Open Graph tags
- Twitter Card tags
- Language attribute
- Robots directives

### Content Analysis
- Heading hierarchy (H1-H6)
- Image alt attributes
- Image dimensions and lazy loading
- Internal and external links
- Anchor text quality
- Word count
- Paragraph readability

### Technical Analysis
- Page load time
- Page size
- HTTPS
- HTTP status code
- Structured data (JSON-LD)
- Mobile-friendliness
- Favicon
- CSS/JS resource count
- Render-blocking resources
- Compression

### Link Analysis
- Internal vs external link ratio
- Generic anchor text detection
- Nofollow usage
- Broken link detection (optional)

## Scoring

Each category is scored 0-100 and weighted to produce an overall score:

| Category | Weight |
|----------|--------|
| Meta | 25% |
| Content | 20% |
| Technical | 20% |
| Performance | 15% |
| Mobile | 10% |
| Links | 10% |

**Grades:** A (90+), B (80-89), C (70-79), D (50-69), F (<50)

## License

MIT
Loading