Skip to content

Latest commit

 

History

History
313 lines (245 loc) · 6.79 KB

File metadata and controls

313 lines (245 loc) · 6.79 KB

SEO Toolkit - Quick Start Guide

Get started with ContentSwift's professional SEO analysis tools in 5 minutes!

🚀 Quick Installation

# 1. Install dependencies
cd backend-crt/src
pip install -r requirements.txt

# 2. Download required models
python -m spacy download en_core_web_sm
python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords')"

# 3. Start the server
cd ../..
cd backend-crt && docker-compose up -d --build

📋 Top 5 Use Cases

1. Analyze Any Webpage (30 seconds)

curl -X POST http://localhost:8000/seo/analyze-page \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

What you get:

  • ✅ Meta tags analysis (title, description)
  • ✅ Heading structure (H1-H6)
  • ✅ Readability scores
  • ✅ Link analysis (internal/external)
  • ✅ Image SEO (alt tags)
  • ✅ Technical SEO metrics

2. Check Keyword Density (10 seconds)

curl -X POST http://localhost:8000/seo/keyword-density \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Your article content here...",
    "keywords": ["SEO", "content marketing"]
  }'

What you get:

  • ✅ Keyword count and density percentage
  • ✅ Optimization recommendations
  • ✅ Keyword stuffing detection

3. Auto-Generate Meta Description (5 seconds)

curl -X POST http://localhost:8000/seo/generate-meta-description \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Your long article content...",
    "max_length": 155
  }'

What you get:

  • ✅ AI-generated meta description
  • ✅ Optimal length (120-160 chars)
  • ✅ Natural language summary

4. Analyze Competitor Keywords (30 seconds)

curl -X POST http://localhost:8000/seo/competitor-analysis \
  -H "Content-Type: application/json" \
  -d '{
    "competitor_urls": [
      "https://competitor1.com",
      "https://competitor2.com"
    ]
  }'

What you get:

  • ✅ Common keywords across competitors
  • ✅ TF-IDF scores
  • ✅ Keyword gap opportunities

5. Extract Keywords from Content (15 seconds)

curl -X POST http://localhost:8000/seo/extract-keywords \
  -H "Content-Type: application/json" \
  -d '{
    "documents": [
      "Your content 1...",
      "Your content 2..."
    ],
    "max_features": 20
  }'

What you get:

  • ✅ Top keywords by TF-IDF
  • ✅ Unigrams, bigrams, trigrams
  • ✅ Importance scores

🎯 Complete Workflow Example

Optimize a blog post in 3 steps:

Step 1: Analyze Current Page

# Check current SEO status
curl -X POST http://localhost:8000/seo/analyze-page \
  -H "Content-Type: application/json" \
  -d '{"url": "https://yourblog.com/post"}' \
  > analysis.json

Step 2: Check Keyword Optimization

# Verify keyword density
curl -X POST http://localhost:8000/seo/keyword-density \
  -H "Content-Type: application/json" \
  -d '{
    "text": "...",
    "keywords": ["your", "target", "keywords"]
  }' > keywords.json

Step 3: Generate Optimized Meta Description

# Create SEO-friendly meta description
curl -X POST http://localhost:8000/seo/generate-meta-description \
  -H "Content-Type: application/json" \
  -d '{"text": "..."}' > meta.json

🛠️ Essential Commands

Analyze Robots.txt

curl http://localhost:8000/seo/robots-txt/example.com

Analyze Sitemap

curl -X POST http://localhost:8000/seo/analyze-sitemap \
  -H "Content-Type: application/json" \
  -d '{"sitemap_url": "https://example.com/sitemap.xml"}'

Extract N-grams

curl -X POST http://localhost:8000/seo/extract-ngrams \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Your content...",
    "n": 2,
    "top_n": 20
  }'

Cluster Keywords

curl -X POST http://localhost:8000/seo/cluster-keywords \
  -H "Content-Type: application/json" \
  -d '{
    "keywords": ["keyword1", "keyword2", "keyword3"],
    "n_clusters": 3
  }'

📊 Understanding the Results

Meta Tags Analysis

  • Optimal Title: 30-60 characters
  • Optimal Description: 120-160 characters
  • H1 Count: Should be exactly 1

Keyword Density

  • 0-1%: Too low, increase usage
  • 1-3%: ✅ Optimal range
  • 3-5%: Too high, risk of keyword stuffing
  • 5%+: ⚠️ Keyword stuffing detected

Readability Scores

  • Flesch Reading Ease:
    • 90-100: Very Easy (5th grade)
    • 60-70: Standard (8th-9th grade) ✅ Target
    • 0-30: Very Difficult (College+)

Link Analysis

  • Internal Links: 2-5 per page recommended
  • External Links: Relevant, authoritative sources
  • Nofollow: Use for untrusted/paid links

💡 Pro Tips

1. Batch Processing

Analyze multiple URLs at once:

curl -X POST http://localhost:8000/seo/batch-analyze \
  -H "Content-Type: application/json" \
  -d '{
    "urls": ["url1", "url2", "url3"]
  }'

2. Python Integration

import requests

# Analyze page
response = requests.post(
    'http://localhost:8000/seo/analyze-page',
    json={'url': 'https://example.com'}
)

result = response.json()
print(f"Title: {result['data']['meta_tags']['title']['content']}")
print(f"Word Count: {result['data']['content_stats']['word_count']}")

3. Automated SEO Audits

Create a script to audit all your pages:

#!/bin/bash
for url in $(cat urls.txt); do
  curl -X POST http://localhost:8000/seo/analyze-page \
    -H "Content-Type: application/json" \
    -d "{\"url\": \"$url\"}" \
    > "results/$(echo $url | md5sum | cut -d' ' -f1).json"
done

🔧 Troubleshooting

Issue: NLTK data not found

import nltk
nltk.download('all')

Issue: Spacy model not found

python -m spacy download en_core_web_sm

Issue: Connection timeout

  • Increase timeout in your requests
  • Check if the URL is accessible
  • Verify firewall settings

Issue: Memory error

  • Reduce batch size
  • Process URLs sequentially
  • Increase Docker memory limit

📚 Next Steps

  1. Read Full Documentation: /SEO_TOOLKIT_GUIDE.md
  2. Try Examples: python backend-crt/src/seo_examples.py
  3. Check API Docs: http://localhost:8000/docs (FastAPI auto-docs)
  4. Join Community: Report issues on GitHub

🎓 Learning Resources


⚡ Performance

Operation Time Memory
Page Analysis 2-5s ~100MB
Keyword Density <1s ~50MB
Meta Generation 1-2s ~100MB
Competitor Analysis 3-10s ~200MB
Batch (10 URLs) 20-50s ~500MB

Need Help? Check /SEO_TOOLKIT_GUIDE.md for comprehensive documentation!

Happy Optimizing! 🚀