تحسين خصائص تحسين محركات البحث عبر صفحات ومكونات متعددة، بما في ذلك إضافة البيانات المنظمة، وعلامات OpenGraph، ومكون SEOHead قابل لإعادة الاستخدام. تحديث عملية إنشاء خريطة الموقع لتشمل مسارات جديدة وتحسين ظهور الموقع بشكل عام.---Enhance SEO features across multiple pages and components, including the addition of structured data, OpenGraph tags, and a reusable SEOHead component. Update sitemap generation to include new routes and improve overall site visibility.

This commit is contained in:
Your Name
2026-03-09 20:56:43 +02:00
parent ce5c85ec7d
commit 9990415a51
12 changed files with 229 additions and 81 deletions

View File

@@ -1,39 +1,55 @@
#!/usr/bin/env python3
"""
generate_sitemap.py
Generates sitemap.xml for SEO.
Generates sitemap.xml for SEO from the full route inventory.
Usage:
python scripts/generate_sitemap.py --domain https://yourdomain.com
python scripts/generate_sitemap.py --domain https://yourdomain.com --output frontend/public/sitemap.xml
"""
import argparse
from datetime import datetime
TOOLS = [
'/tools/pdf-to-word',
'/tools/word-to-pdf',
'/tools/compress-pdf',
'/tools/merge-pdf',
'/tools/split-pdf',
'/tools/rotate-pdf',
'/tools/pdf-to-images',
'/tools/images-to-pdf',
'/tools/watermark-pdf',
'/tools/protect-pdf',
'/tools/unlock-pdf',
'/tools/page-numbers',
'/tools/image-converter',
'/tools/video-to-gif',
'/tools/word-counter',
'/tools/text-cleaner',
]
# ─── Route definitions with priority and changefreq ──────────────────────────
PAGES = [
'/',
'/about',
'/privacy',
{'path': '/', 'changefreq': 'daily', 'priority': '1.0'},
{'path': '/about', 'changefreq': 'monthly', 'priority': '0.4'},
{'path': '/contact', 'changefreq': 'monthly', 'priority': '0.4'},
{'path': '/privacy', 'changefreq': 'yearly', 'priority': '0.3'},
{'path': '/terms', 'changefreq': 'yearly', 'priority': '0.3'},
]
# PDF Tools
PDF_TOOLS = [
'pdf-to-word', 'word-to-pdf', 'compress-pdf', 'merge-pdf',
'split-pdf', 'rotate-pdf', 'pdf-to-images', 'images-to-pdf',
'watermark-pdf', 'remove-watermark-pdf', 'protect-pdf', 'unlock-pdf',
'page-numbers', 'reorder-pdf', 'extract-pages', 'pdf-editor',
'pdf-flowchart', 'pdf-to-excel',
]
# Image Tools
IMAGE_TOOLS = [
'image-converter', 'image-resize', 'compress-image', 'remove-background',
]
# AI Tools
AI_TOOLS = [
'ocr', 'chat-pdf', 'summarize-pdf', 'translate-pdf', 'extract-tables',
]
# Convert / Utility Tools
UTILITY_TOOLS = [
'html-to-pdf', 'qr-code', 'video-to-gif', 'word-counter', 'text-cleaner',
]
TOOL_GROUPS = [
('PDF Tools', PDF_TOOLS, '0.9'),
('Image Tools', IMAGE_TOOLS, '0.8'),
('AI Tools', AI_TOOLS, '0.8'),
('Utility Tools', UTILITY_TOOLS, '0.7'),
]
@@ -41,30 +57,24 @@ def generate_sitemap(domain: str) -> str:
today = datetime.now().strftime('%Y-%m-%d')
urls = []
# Home page — highest priority
urls.append(f''' <url>
<loc>{domain}/</loc>
# Static pages
for page in PAGES:
urls.append(f''' <url>
<loc>{domain}{page["path"]}</loc>
<lastmod>{today}</lastmod>
<changefreq>{page["changefreq"]}</changefreq>
<priority>{page["priority"]}</priority>
</url>''')
# Tool pages by category
for label, slugs, priority in TOOL_GROUPS:
urls.append(f'\n <!-- {label} -->')
for slug in slugs:
urls.append(f''' <url>
<loc>{domain}/tools/{slug}</loc>
<lastmod>{today}</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>''')
# Tool pages — high priority
for tool in TOOLS:
urls.append(f''' <url>
<loc>{domain}{tool}</loc>
<lastmod>{today}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.9</priority>
</url>''')
# Static pages — lower priority
for page in PAGES[1:]:
urls.append(f''' <url>
<loc>{domain}{page}</loc>
<lastmod>{today}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
<priority>{priority}</priority>
</url>''')
sitemap = f'''<?xml version="1.0" encoding="UTF-8"?>
@@ -87,8 +97,9 @@ def main():
with open(args.output, 'w', encoding='utf-8') as f:
f.write(sitemap)
total = len(PAGES) + sum(len(slugs) for _, slugs, _ in TOOL_GROUPS)
print(f"Sitemap generated: {args.output}")
print(f"URLs: {len(TOOLS) + len(PAGES)}")
print(f"Total URLs: {total}")
if __name__ == '__main__':