استخدم هذه الخطوات كقائمة تحقق عملية، وكيّفها مع أدلة المشروع ونطاقه وقيوده.
خطوات عملية
- افتح الصفحة التي تريد فحصها ووحدة تحكم مطوري المتصفح. استخدم أولًا وضع العرض المتجاوب لفاحص التجاوز على الهاتف المحمول.
- راجع الشيفرة، والصق المقتطف كاملًا في وحدة التحكم، ثم اضغط Enter. تقرأ الأداة الصفحة الحالية؛ ولا تجري طلبات محدودة إلا أداة بيانات sitemap الوصفية وأدوات فحص الأصل نفسه (البروتوكول والنطاق والمنفذ).
- راجع مخرجات وحدة التحكم أو ملف CSV/JSON الذي تم تنزيله. قد تجعل سياسات المتصفح والمصادقة وطرق الخادم غير المدعومة بعض الفحوص غير حاسمة.
(() => {
const meta = (name, attr = 'name') => document.querySelector('meta[' + attr + '="' + name + '"]')?.content || '';
const links = (rel) => [...document.querySelectorAll('link[rel="' + rel + '"]')].map((node) => ({ href: node.href, hreflang: node.hreflang || '' }));
const report = {
url: location.href,
title: document.title,
titleLength: document.title.length,
description: meta('description'),
descriptionLength: meta('description').length,
robots: meta('robots'),
canonical: links('canonical')[0]?.href || '',
language: document.documentElement.lang || '',
headings: Object.fromEntries([1, 2, 3, 4, 5, 6].map((level) => ['h' + level, [...document.querySelectorAll('h' + level)].map((node) => node.innerText.trim()).filter(Boolean)])),
hreflang: links('alternate').filter((item) => item.hreflang),
openGraph: Object.fromEntries([...document.querySelectorAll('meta[property^="og:"]')].map((node) => [node.getAttribute('property'), node.content])),
twitter: Object.fromEntries([...document.querySelectorAll('meta[name^="twitter:"]')].map((node) => [node.name, node.content])),
jsonLdBlocks: document.querySelectorAll('script[type="application/ld+json"]').length,
};
console.table({ title: report.title, titleLength: report.titleLength, descriptionLength: report.descriptionLength, robots: report.robots, canonical: report.canonical, language: report.language, h1Count: report.headings.h1.length, hreflangCount: report.hreflang.length, jsonLdBlocks: report.jsonLdBlocks });
console.log('Full SEO page report:', report);
const link = document.createElement('a');
link.href = URL.createObjectURL(new Blob([JSON.stringify(report, null, 2)], { type: 'application/json' }));
link.download = 'seo-page-audit.json';
link.click();
setTimeout(() => URL.revokeObjectURL(link.href), 1000);
})();راجع الشيفرة قبل تشغيلها. تقرأ الصفحة الحالية؛ ولا تجري طلبات محدودة إلى الأصل نفسه (البروتوكول والنطاق والمنفذ) إلا فحوص sitemap والروابط. لا ترسل الطلبات ملفات تعريف الارتباط، ولا تغيّر الشيفرة محتوى الموقع.