Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

New tools

Blue Mouse934b68878cc7
diff --git a/web/app/components/ToolsNav.tsx b/web/app/components/ToolsNav.tsx
index 1c2f036ef..3e032e342 100644
--- a/web/app/components/ToolsNav.tsx
+++ b/web/app/components/ToolsNav.tsx
@@ -104,6 +104,90 @@ export const TOOLS = [
href: '/tools/page-size-checker',
icon: GaugeIcon,
},
+ {
+ id: 'indexability-checker',
+ title: 'Indexability Checker',
+ description: 'Check if Google can index a page',
+ href: '/tools/indexability-checker',
+ icon: FileSearchIcon,
+ },
+ {
+ id: 'robots-txt-tester',
+ title: 'Robots.txt Tester',
+ description: 'Test crawler access for a specific path',
+ href: '/tools/robots-txt-tester',
+ icon: RobotIcon,
+ },
+ {
+ id: 'broken-link-checker',
+ title: 'Broken Link Checker',
+ description: 'Find 404s, redirects, and invalid links',
+ href: '/tools/broken-link-checker',
+ icon: LinkBreakIcon,
+ },
+ {
+ id: 'hreflang-checker',
+ title: 'Hreflang Checker',
+ description: 'Validate international SEO alternates',
+ href: '/tools/hreflang-checker',
+ icon: GlobeIcon,
+ },
+ {
+ id: 'serp-snippet-preview',
+ title: 'SERP Snippet Preview',
+ description: 'Preview Google title and description snippets',
+ href: '/tools/serp-snippet-preview',
+ icon: FileMagnifyingGlassIcon,
+ },
+ {
+ id: 'on-page-seo-checker',
+ title: 'On-Page SEO Checker',
+ description: 'Audit titles, headings, links, images, and schema',
+ href: '/tools/on-page-seo-checker',
+ icon: FileSearchIcon,
+ },
+ {
+ id: 'image-seo-checker',
+ title: 'Image SEO Checker',
+ description: 'Audit alt text, dimensions, sizes, and formats',
+ href: '/tools/image-seo-checker',
+ icon: FileMagnifyingGlassIcon,
+ },
+ {
+ id: 'internal-link-analyzer',
+ title: 'Internal Link Analyzer',
+ description: 'Inspect anchors, rel attributes, and link groups',
+ href: '/tools/internal-link-analyzer',
+ icon: LinkIcon,
+ },
+ {
+ id: 'ai-search-llm-crawlability-checker',
+ title: 'AI Crawlability Checker',
+ description: 'Check AI crawler rules, llms.txt, and schema',
+ href: '/tools/ai-search-llm-crawlability-checker',
+ icon: RobotIcon,
+ },
+ {
+ id: 'gsc-export-analyzer',
+ title: 'GSC Export Analyzer',
+ description: 'Find CTR gaps, quick wins, and cannibalization',
+ href: '/tools/gsc-export-analyzer',
+ icon: ChartLineUpIcon,
+ },
+ {
+ id: 'http-status-bulk-checker',
+ title: 'HTTP Status Bulk Checker',
+ description: 'Check statuses and redirects for URL lists',
+ href: '/tools/http-status-bulk-checker',
+ icon: NetworkIcon,
+ },
+ {
+ id: 'seo-migration-redirect-validator',
+ title: 'Migration Redirect Validator',
+ description: 'Validate old to new URL redirect mappings',
+ href: '/tools/seo-migration-redirect-validator',
+ icon: LinkBreakIcon,
+ },
{
id: 'uptime-sla-calculator',
title: 'Uptime SLA Calculator',
diff --git a/web/app/components/tools/TechnicalToolRoute.tsx b/web/app/components/tools/TechnicalToolRoute.tsx
index f6e067053..e6e83dd6a 100644
--- a/web/app/components/tools/TechnicalToolRoute.tsx
+++ b/web/app/components/tools/TechnicalToolRoute.tsx
@@ -1,5 +1,6 @@
import {
CheckCircleIcon,
+ DownloadSimpleIcon,
MagnifyingGlassIcon,
WarningCircleIcon,
XCircleIcon,
@@ -17,6 +18,7 @@ import Button from '~/ui/Button'
import CodeBlock from '~/ui/CodeBlock'
import { FAQ } from '~/ui/FAQ'
import Input from '~/ui/Input'
+import Textarea from '~/ui/Textarea'
import { Text } from '~/ui/Text'
import { cn } from '~/utils/generic'
import { getDescription, getPreviewImage, getTitle } from '~/utils/seo'
@@ -30,12 +32,24 @@ type ServerToolSlug =
| 'csp-checker'
| 'canonical-url-checker'
| 'page-size-checker'
+ | 'indexability-checker'
+ | 'robots-txt-tester'
+ | 'broken-link-checker'
+ | 'hreflang-checker'
+ | 'on-page-seo-checker'
+ | 'image-seo-checker'
+ | 'internal-link-analyzer'
+ | 'ai-search-llm-crawlability-checker'
+ | 'http-status-bulk-checker'
+ | 'seo-migration-redirect-validator'
type CalculatorToolSlug =
| 'uptime-sla-calculator'
| 'website-bandwidth-calculator'
-type TechnicalToolSlug = ServerToolSlug | CalculatorToolSlug
+type ClientToolSlug = 'serp-snippet-preview' | 'gsc-export-analyzer'
+
+type TechnicalToolSlug = ServerToolSlug | CalculatorToolSlug | ClientToolSlug
type IssueLevel = 'good' | 'warning' | 'error' | 'info'
@@ -172,6 +186,250 @@ interface PageSizeResult {
issues: Issue[]
}
+interface RobotsRuleResult {
+ directive: 'allow' | 'disallow'
+ path: string
+}
+
+interface IndexabilityResult {
+ requestedUrl: string
+ finalUrl: string
+ status: number
+ indexability: string
+ robotsTxt: {
+ url: string
+ status: number | null
+ allowed: boolean
+ matchedRule: RobotsRuleResult | null
+ }
+ metaRobots: string | null
+ xRobotsTag: string | null
+ canonical: string | null
+ absoluteCanonical: string | null
+ sitemapHint: string | null
+ title: string | null
+ description: string | null
+ issues: Issue[]
+}
+
+interface RobotsTesterResult {
+ robotsUrl: string
+ path: string
+ userAgent: string
+ allowed: boolean
+ matchedRule: RobotsRuleResult | null
+ groupAgents: string[]
+ tests: Array<{
+ userAgent: string
+ allowed: boolean
+ matchedRule: RobotsRuleResult | null
+ groupAgents: string[]
+ }>
+ sitemaps: string[]
+ issues: Issue[]
+}
+
+interface BrokenLinkResult {
+ sourceUrl: string
+ finalUrl: string
+ sourceType: string
+ totalLinks: number
+ checkedLinks: number
+ internalCount: number
+ externalCount: number
+ brokenCount: number
+ redirectCount: number
+ emptyAnchorCount: number
+ invalidUrlCount: number
+ limit: number
+ links: Array<{
+ url: string
+ anchor: string
+ kind: string
+ status: number | null
+ finalUrl: string
+ redirectCount: number
+ issue: string
+ error: string | null
+ }>
+ invalidLinks: Array<{
+ href: string | null
+ anchor: string
+ issue: string
+ }>
+ issues: Issue[]
+}
+
+interface HreflangResult {
+ requestedUrl: string
+ finalUrl: string
+ status: number
+ canonical: string | null
+ tags: Array<{
+ hreflang: string | null
+ href: string | null
+ absoluteUrl: string | null
+ isAbsolute: boolean
+ }>
+ invalidCount: number
+ duplicateCount: number
+ hasXDefault: boolean
+ reciprocalChecks: Array<{
+ url: string | null
+ status: number | null
+ hasReturnTag: boolean
+ error: string | null
+ }>
+ issues: Issue[]
+}
+
+interface OnPageSeoResult {
+ requestedUrl: string
+ finalUrl: string
+ status: number
+ title: string | null
+ titleLength: number
+ description: string | null
+ descriptionLength: number
+ h1: string[]
+ h2: string[]
+ canonical: string | null
+ robots: string | null
+ wordCount: number
+ imageCount: number
+ imagesMissingAlt: number
+ imagesEmptyAlt: number
+ internalLinks: number
+ externalLinks: number
+ structuredDataCount: number
+ openGraphCount: number
+ textHtmlRatio: number
+ issues: Issue[]
+}
+
+interface ImageSeoResult {
+ requestedUrl: string
+ finalUrl: string
+ status: number
+ imageCount: number
+ checkedImages: number
+ missingAlt: number
+ emptyAlt: number
+ missingDimensions: number
+ lazyImages: number
+ largeImages: number
+ modernFormats: number
+ images: Array<{
+ src: string | null
+ alt: string | null
+ hasAlt: boolean
+ width: string | null
+ height: string | null
+ loading: string | null
+ format: string
+ size: string
+ bytes: number | null
+ isLarge: boolean
+ hasDimensions: boolean
+ isModernFormat: boolean
+ }>
+ issues: Issue[]
+}
+
+interface InternalLinkResult {
+ requestedUrl: string
+ finalUrl: string
+ status: number
+ totalLinks: number
+ internalCount: number
+ externalCount: number
+ nofollowCount: number
+ sponsoredCount: number
+ ugcCount: number
+ fragmentCount: number
+ mailtoCount: number
+ telCount: number
+ emptyAnchorCount: number
+ duplicateAnchors: Array<{
+ anchor: string
+ urls: string[]
+ count: number
+ }>
+ links: Array<{
+ url: string
+ anchor: string
+ rel: string
+ kind: string
+ isEmpty: boolean
+ }>
+ issues: Issue[]
+}
+
+interface AiCrawlabilityResult {
+ requestedUrl: string
+ finalUrl: string
+ status: number
+ robotsUrl: string
+ robotsStatus: number | null
+ crawlerRules: Array<{
+ crawler: string
+ allowed: boolean
+ matchedRule: RobotsRuleResult | null
+ groupAgents: string[]
+ }>
+ llms: { url: string; status: number | null; finalUrl: string }
+ llmsFull: { url: string; status: number | null; finalUrl: string }
+ sitemap: { url: string; status: number | null; finalUrl: string }
+ canonical: string | null
+ title: string | null
+ description: string | null
+ structuredDataCount: number
+ issues: Issue[]
+}
+
+interface BulkStatusResult {
+ checked: number
+ limit: number
+ ok: number
+ redirects: number
+ errors: number
+ rows: Array<{
+ url: string
+ status: number | null
+ finalUrl: string
+ redirectCount: number
+ contentType: string | null
+ issue: string
+ error: string | null
+ }>
+ csv: string
+ issues: Issue[]
+}
+
+interface MigrationRedirectResult {
+ checked: number
+ limit: number
+ passed: number
+ mismatches: number
+ temporary: number
+ longChains: number
+ queryDrops: number
+ rows: Array<{
+ oldUrl: string
+ expectedUrl: string
+ finalUrl: string
+ status: number | null
+ redirectType: number | string
+ redirectCount: number
+ finalMatches: boolean
+ preservesQuery: boolean
+ result: string
+ error: string | null
+ }>
+ csv: string
+ issues: Issue[]
+}
+
const TOOL_CONTENT: Record<TechnicalToolSlug, ToolContent> = {
'dns-lookup': {
title: 'DNS Lookup',
@@ -587,188 +845,738 @@ const TOOL_CONTENT: Record<TechnicalToolSlug, ToolContent> = {
},
],
},
- 'uptime-sla-calculator': {
- title: 'Uptime SLA Calculator',
- metaTitle: 'Free Uptime SLA Calculator - Downtime and Availability Tool',
+ 'indexability-checker': {
+ title: 'Indexability Checker',
+ metaTitle: 'Free Indexability Checker - Can Google Index This Page?',
metaDescription:
- 'Calculate uptime percentage, downtime allowance, monthly SLA targets, availability from incident minutes, and hosting reliability impact.',
+ 'Check whether Google can index a page. Audit status code, final URL, robots.txt, meta robots, X-Robots-Tag, canonical URL, title, description, and sitemap hints.',
description:
- 'Convert uptime targets into allowed downtime and calculate real availability from incident minutes across monthly, quarterly, or yearly periods.',
- seoTitle: 'Free Uptime SLA Calculator',
+ 'Audit one URL and answer the practical question: can Google crawl and index this page?',
+ inputLabel: 'Page URL',
+ placeholder: 'https://swetrix.com/tools',
+ buttonLabel: 'Check indexability',
+ seoTitle: 'Free Indexability Checker',
seoDescription:
- 'Uptime targets are easier to understand when they are converted into minutes of downtime. This calculator helps hosting teams, SaaS founders, and website owners compare promised SLA numbers with real outages.',
+ 'Indexability problems are often small technical signals with large traffic impact. This checker inspects the live response, robots.txt access, robots directives, canonical URL, and page metadata so you can see whether a page is eligible for Google indexing.',
sections: [
{
- title: 'Why uptime belongs next to analytics',
- body: 'A traffic drop is not always a marketing problem. Outages, partial downtime, DNS failures, and certificate issues can all reduce visits and conversions before a campaign has a chance to work.',
+ title: 'What this indexability audit checks',
+ body: 'The report checks the HTTP status, final redirected URL, robots.txt rule for Googlebot, meta robots, X-Robots-Tag, canonical URL, title, description, and sitemap hints from robots.txt.',
},
{
- title: 'Common SLA targets',
- body: '99% uptime allows much more downtime than 99.9%, and 99.99% is a different operating discipline again. Use the calculator to translate each target into monthly minutes.',
+ title: 'How to read the result',
+ body: 'A page can be reachable but still not indexable. Hard blockers include non-200 responses, robots.txt disallow rules, and noindex directives. Canonical and metadata issues are usually cleanup tasks unless they point away from the page you expect to rank.',
},
],
faq: [
{
- question: 'How do you calculate uptime percentage?',
+ question: 'Can Google index a page blocked by robots.txt?',
answer:
- 'Uptime percentage is calculated as available minutes divided by total minutes in the period, multiplied by 100.',
+ 'Google generally cannot crawl the blocked page content. If the URL is discovered elsewhere, it may still appear with limited information, but blocking crawl is not the same as controlling indexing with noindex.',
},
{
- question: 'How much downtime does 99.9% uptime allow?',
+ question: 'What is the difference between noindex and robots.txt?',
answer:
- 'In a 30 day month, 99.9% uptime allows about 43.2 minutes of downtime.',
+ 'Noindex is a page-level directive that tells search engines not to index the page after they crawl it. robots.txt controls whether crawlers can request a path.',
},
{
- question: 'What is the difference between uptime and availability?',
+ question: 'Does a different canonical URL block indexing?',
answer:
- 'They are often used together. Uptime usually refers to whether the service is reachable, while availability can include whether critical functions are working correctly.',
+ 'Not directly. A canonical pointing elsewhere tells search engines that another URL is preferred, so the checked URL may not be selected for search results.',
},
{
- question: 'Can downtime affect SEO?',
+ question: 'Why does final URL matter for SEO?',
answer:
- 'Short outages usually have limited SEO impact, but repeated or extended downtime can affect crawling, user signals, and revenue.',
+ 'Search engines evaluate the final response after redirects. Unexpected final URLs can reveal redirect mistakes, canonical host issues, or migration problems.',
},
+ ],
+ },
+ 'robots-txt-tester': {
+ title: 'Robots.txt Tester',
+ metaTitle: 'Free Robots.txt Tester - Check Googlebot and AI Crawler Access',
+ metaDescription:
+ 'Test robots.txt rules for a URL path and user agent. Check Googlebot, Bingbot, GPTBot, ChatGPT-User, ClaudeBot, PerplexityBot, and other crawler access.',
+ description:
+ 'Enter a site, path, and crawler user agent to see whether robots.txt allows or blocks crawling.',
+ inputLabel: 'Website or robots.txt URL',
+ placeholder: 'https://example.com/robots.txt',
+ buttonLabel: 'Test robots.txt',
+ seoTitle: 'Free Robots.txt Tester',
+ seoDescription:
+ 'Robots.txt rules decide which crawlers can request which paths. This tester parses Allow and Disallow rules with longest-match precedence, then compares common search and AI crawlers so you can catch accidental blocks before they cost traffic.',
+ sections: [
{
- question: 'Can Swetrix help explain traffic drops?',
+ title: 'How robots.txt matching works',
+ body: 'Crawlers choose the most specific matching user-agent group, then apply the longest matching Allow or Disallow rule for the requested path. If Allow and Disallow tie, Allow usually wins.',
+ },
+ {
+ title: 'Crawler rules deserve version control',
+ body: 'Robots rules change during staging launches, migrations, and AI crawler policy updates. Testing specific paths helps avoid blocking valuable pages while still protecting private or duplicate areas.',
+ },
+ ],
+ faq: [
+ {
+ question: 'Does robots.txt remove pages from Google?',
answer:
- 'Yes. Swetrix combines traffic, performance, errors, and alerts so you can connect reliability issues with user behavior.',
+ 'No. robots.txt controls crawling. To remove a page from search results, use noindex on a crawlable page or remove the URL and return an appropriate status.',
+ },
+ {
+ question: 'What user agent should I test for Google?',
+ answer:
+ 'Use Googlebot for general web search crawling. Some Google products use specialized crawlers, but Googlebot is the main SEO check.',
+ },
+ {
+ question: 'Can I block AI crawlers with robots.txt?',
+ answer:
+ 'Many AI crawlers publish user-agent names and respect robots.txt, but behavior varies by provider. Use explicit groups for the crawlers you care about.',
+ },
+ {
+ question: 'What does an empty Disallow mean?',
+ answer:
+ 'An empty Disallow line means crawling is allowed for that group because no path is being disallowed.',
},
],
},
- 'website-bandwidth-calculator': {
- title: 'Website Bandwidth Calculator',
- metaTitle:
- 'Free Website Bandwidth Calculator - Estimate Hosting Traffic Usage',
+ 'broken-link-checker': {
+ title: 'Broken Link Checker',
+ metaTitle: 'Free Broken Link Checker - Find 404 and Redirect Issues',
metaDescription:
- 'Estimate monthly website bandwidth from visits, pages per visit, page weight, cache hit rate, and traffic growth. Useful for hosting, CDN, and analytics planning.',
+ 'Check a page or sitemap for broken links. Find internal and external 404s, 5xx errors, redirects, invalid URLs, and empty anchor text with safe request limits.',
description:
- 'Estimate monthly hosting bandwidth from visits, pages per visit, average page weight, cache hit rate, and expected traffic growth.',
- seoTitle: 'Free Website Bandwidth Calculator',
+ 'Scan a page or sitemap, check linked URLs, and flag broken responses, redirects, invalid hrefs, and empty anchors.',
+ inputLabel: 'Page or sitemap URL',
+ placeholder: 'https://example.com/blog/post',
+ buttonLabel: 'Check links',
+ seoTitle: 'Free Broken Link Checker',
seoDescription:
- 'Bandwidth planning helps you choose hosting plans, estimate CDN usage, and understand how growth affects infrastructure cost. This calculator turns traffic assumptions into monthly GB and average Mbps estimates.',
+ 'Broken links waste crawl budget, frustrate visitors, and quietly weaken internal linking. This checker scans a page or sitemap with capped requests, then separates internal and external link problems so you know what to fix first.',
sections: [
{
- title: 'How to estimate bandwidth',
- body: 'Monthly bandwidth depends on page views, transferred page weight, caching, and growth. Use real analytics data when available, then add a growth margin for campaigns or launches.',
+ title: 'What counts as a broken link',
+ body: 'The tool flags failed requests, 404 and 410 not found responses, 5xx server errors, invalid href values, and empty anchors. Redirects are shown separately because they may be intentional but still worth cleaning up.',
},
{
- title: 'Why analytics data helps hosting decisions',
- body: 'Traffic volume, top pages, geography, and campaign spikes all influence bandwidth. Analytics helps you size hosting from actual behavior instead of rough guesses.',
+ title: 'Why broken links affect analytics',
+ body: 'Broken internal paths create dead ends in user journeys. In analytics, that can appear as high exits, failed conversions, or sudden drops on pages that used to send traffic deeper into the site.',
},
],
faq: [
{
- question: 'What is website bandwidth?',
+ question: 'Can this checker scan an entire website?',
answer:
- 'Website bandwidth is the amount of data transferred from your server or CDN to visitors over a period of time.',
+ 'It is designed as a lightweight page or sitemap check with request limits. For full-site crawling, use a dedicated crawler and monitor the highest-value pages regularly.',
},
{
- question: 'How do I find my average page weight?',
+ question: 'Should I fix redirected internal links?',
answer:
- 'Use a page size checker, browser devtools, or a performance audit. Include HTML, CSS, JavaScript, images, fonts, and other assets that load during a visit.',
+ 'Yes, when practical. Redirects work, but linking directly to the final URL is faster and easier for crawlers to process.',
},
{
- question: 'Does caching reduce bandwidth?',
+ question: 'Are external broken links bad for SEO?',
answer:
- 'Yes. Browser and CDN caching can reduce repeated transfers, especially for static assets such as images, scripts, and stylesheets.',
+ 'A few external issues are normal, but many broken references create a poor user experience and can make content look neglected.',
},
{
- question: 'How much bandwidth do I need for 100,000 visits?',
+ question: 'Why are some links not checked?',
answer:
- 'It depends on pages per visit and page weight. For example, 100,000 visits with 2 pages per visit and 1 MB transferred per page uses about 195 GB before caching adjustments.',
+ 'The tool caps requests to keep scans fast and safe. It prioritizes unique HTTP and HTTPS URLs found in the HTML or sitemap.',
+ },
+ ],
+ },
+ 'hreflang-checker': {
+ title: 'Hreflang Checker',
+ metaTitle: 'Free Hreflang Checker - Validate International SEO Tags',
+ metaDescription:
+ 'Check hreflang tags for any page. Validate language-region codes, x-default, duplicates, absolute URLs, canonical conflicts, and reciprocal hreflang hints.',
+ description:
+ 'Validate hreflang tags, language codes, x-default, canonicals, duplicate alternates, and reciprocal hints.',
+ inputLabel: 'Page URL',
+ placeholder: 'https://example.com/en-gb/',
+ buttonLabel: 'Check hreflang',
+ seoTitle: 'Free Hreflang Checker',
+ seoDescription:
+ 'Hreflang tags help search engines show the right language or regional URL to the right audience. This checker catches common international SEO mistakes such as invalid language codes, duplicate alternates, missing x-default, and canonical conflicts.',
+ sections: [
+ {
+ title: 'Common hreflang mistakes',
+ body: 'The most common issues are relative URLs, invalid language-region codes, duplicate hreflang values, missing return tags, and pages that canonicalize to a different language version.',
},
{
- question: 'Can Swetrix provide the traffic inputs?',
+ title: 'When hreflang is useful',
+ body: 'Use hreflang when similar pages target different languages or regions, such as English for the US and English for the UK. Single-language sites do not need hreflang.',
+ },
+ ],
+ faq: [
+ {
+ question: 'What is x-default hreflang?',
answer:
- 'Yes. Swetrix shows visits, page views, top pages, referrers, countries, and campaign data that help you estimate real bandwidth needs.',
+ 'x-default marks the fallback URL for users who do not match any specific language or region alternate.',
+ },
+ {
+ question: 'Should hreflang URLs be absolute?',
+ answer:
+ 'Absolute URLs are recommended because they are unambiguous for crawlers and easier to validate across domains.',
+ },
+ {
+ question: 'Can hreflang fix duplicate content?',
+ answer:
+ 'Hreflang helps search engines serve the right regional version. It does not replace canonical tags or unique content strategy.',
+ },
+ {
+ question: 'Do hreflang pages need return tags?',
+ answer:
+ 'Yes. Each alternate should usually reference the other alternates in the cluster, including the page being checked.',
},
],
},
-}
-
-const ISSUE_STYLES: Record<IssueLevel, string> = {
- good: 'bg-emerald-50 text-emerald-700 ring-emerald-200 dark:bg-emerald-500/10 dark:text-emerald-300 dark:ring-emerald-500/25',
- warning:
- 'bg-amber-50 text-amber-800 ring-amber-200 dark:bg-amber-500/10 dark:text-amber-300 dark:ring-amber-500/25',
- error:
- 'bg-red-50 text-red-700 ring-red-200 dark:bg-red-500/10 dark:text-red-300 dark:ring-red-500/25',
- info: 'bg-sky-50 text-sky-700 ring-sky-200 dark:bg-sky-500/10 dark:text-sky-300 dark:ring-sky-500/25',
-}
-
-function IssueIcon({ level }: { level: IssueLevel }) {
- if (level === 'good') return <CheckCircleIcon className='size-4' />
- if (level === 'error') return <XCircleIcon className='size-4' />
- return <WarningCircleIcon className='size-4' />
-}
-
-function ResultPanel({ children }: { children: ReactNode }) {
- return (
- <div className='mt-8 rounded-lg bg-white p-6 ring-1 ring-gray-200 dark:bg-slate-950 dark:ring-slate-800'>
- {children}
- </div>
- )
-}
-
-function MetricGrid({
- items,
-}: {
- items: Array<{ label: string; value: ReactNode; hint?: ReactNode }>
-}) {
- return (
- <div className='grid gap-3 sm:grid-cols-2 xl:grid-cols-4'>
- {items.map((item) => (
- <div
- key={item.label}
- className='rounded-lg bg-gray-50 p-4 ring-1 ring-gray-200/80 dark:bg-slate-900 dark:ring-slate-800'
- >
- <Text
- as='p'
- size='xs'
- weight='medium'
- colour='muted'
- className='uppercase'
- >
- {item.label}
- </Text>
- <div className='mt-2 text-2xl font-semibold tracking-tight text-slate-900 dark:text-white'>
- {item.value}
- </div>
- {item.hint ? (
- <Text as='p' size='xs' colour='muted' className='mt-1'>
- {item.hint}
- </Text>
- ) : null}
- </div>
- ))}
- </div>
- )
-}
-
-function KeyValueList({
- items,
-}: {
- items: Array<{ label: string; value: ReactNode; mono?: boolean }>
-}) {
- return (
- <dl className='divide-y divide-gray-100 border-y border-gray-100 dark:divide-slate-800 dark:border-slate-800'>
- {items.map((item) =>
- item.value === null ||
- item.value === undefined ||
- item.value === '' ? null : (
- <div
- key={item.label}
- className='grid gap-1 py-3 sm:grid-cols-[180px_1fr] sm:gap-6'
- >
- <dt className='text-sm text-gray-500 dark:text-slate-400'>
- {item.label}
- </dt>
- <dd
- className={cn(
- 'min-w-0 text-sm font-medium wrap-break-word text-slate-900 dark:text-white',
- item.mono && 'font-mono tabular-nums',
- )}
- >
- {item.value}
+ 'serp-snippet-preview': {
+ title: 'SERP Snippet Preview',
+ metaTitle: 'Free SERP Snippet Preview - Google Title and Description Tool',
+ metaDescription:
+ 'Preview Google desktop and mobile search snippets. Test SEO titles, meta descriptions, URL display, pixel guidance, character length, and truncation warnings.',
+ description:
+ 'Preview how a title, meta description, and URL may appear in Google desktop and mobile search results.',
+ seoTitle: 'Free SERP Snippet Preview Tool',
+ seoDescription:
+ 'Search snippets are not fully under your control, but better title and description drafts improve the odds of a clear result. This client-side preview estimates desktop and mobile truncation using practical pixel and character guidance.',
+ sections: [
+ {
+ title: 'How to write snippet-friendly titles',
+ body: 'Start with the page topic, keep the most important words near the front, and avoid stuffing repeated keywords. A clear title often wins more clicks than a forced exact-match phrase.',
+ },
+ {
+ title: 'Why descriptions still matter',
+ body: 'Meta descriptions are not ranking guarantees, and Google can rewrite them. They still help you draft the clearest promise for a searcher before they click.',
+ },
+ ],
+ faq: [
+ {
+ question: 'Will Google always use my title tag?',
+ answer:
+ 'No. Google may rewrite titles based on the query, page headings, anchors, or other signals. A concise, accurate title gives it a better starting point.',
+ },
+ {
+ question: 'What is a good SEO title length?',
+ answer:
+ 'Many titles fit best around 50 to 60 characters, but pixel width matters more than character count because letters have different widths.',
+ },
+ {
+ question: 'What is a good meta description length?',
+ answer:
+ 'A practical range is about 140 to 160 characters. Shorter can work when the value is clear, and longer descriptions may be truncated or rewritten.',
+ },
+ {
+ question: 'Does meta description affect rankings?',
+ answer:
+ 'Meta descriptions are not a direct ranking factor, but they can affect click-through rate from search results.',
+ },
+ ],
+ },
+ 'on-page-seo-checker': {
+ title: 'On-Page SEO Checker',
+ metaTitle: 'Free On-Page SEO Checker - Audit Titles, H1s, Links and Schema',
+ metaDescription:
+ 'Run a single-page SEO audit. Check title length, meta description, H1 and H2 structure, canonical, robots, word count, image alt text, links, structured data, Open Graph, and text-to-HTML ratio.',
+ description:
+ 'Scan one page for core on-page SEO signals, content structure, metadata, links, images, and schema presence.',
+ inputLabel: 'Page URL',
+ placeholder: 'https://example.com/pricing',
+ buttonLabel: 'Run SEO check',
+ seoTitle: 'Free On-Page SEO Checker',
+ seoDescription:
+ 'On-page SEO is the practical layer you control: title, description, headings, canonicals, crawl directives, content depth, images, internal links, structured data, and social metadata. This checker gives a compact page-level audit without needing a full crawler.',
+ sections: [
+ {
+ title: 'What the on-page audit includes',
+ body: 'The scan checks the live status, title and description length, H1 and H2 headings, canonical URL, robots directives, visible word count, image alt coverage, internal and external links, structured data, Open Graph tags, and text-to-HTML ratio.',
+ },
+ {
+ title: 'Use it before publishing important pages',
+ body: 'Run this check on landing pages, pricing pages, documentation, product pages, and migration targets. It catches the ordinary mistakes that are easiest to fix before launch.',
+ },
+ ],
+ faq: [
+ {
+ question: 'Is on-page SEO enough to rank?',
+ answer:
+ 'No. Rankings also depend on search intent, backlinks, content quality, technical health, competition, and brand demand. On-page SEO makes sure the page itself sends clear signals.',
+ },
+ {
+ question: 'How many H1 tags should a page have?',
+ answer:
+ 'One clear H1 is the simplest pattern for most pages. Multiple H1s can be valid HTML, but they often make the content outline harder to interpret.',
+ },
+ {
+ question: 'Does word count matter for SEO?',
+ answer:
+ 'Word count is only a rough signal. A page should be complete enough to satisfy the query, not long for its own sake.',
+ },
+ {
+ question: 'Why check Open Graph in an SEO audit?',
+ answer:
+ 'Open Graph tags do not directly rank pages, but they shape social sharing previews and can improve referral traffic quality.',
+ },
+ ],
+ },
+ 'image-seo-checker': {
+ title: 'Image SEO Checker',
+ metaTitle: 'Free Image SEO Checker - Audit Alt Text, Sizes and Formats',
+ metaDescription:
+ 'Check images on a page for missing alt text, empty alt text, large known files, missing width and height, lazy loading, modern formats, and largest image URLs.',
+ description:
+ 'Audit page images for alt text, dimensions, lazy loading, modern formats, and large known file sizes.',
+ inputLabel: 'Page URL',
+ placeholder: 'https://example.com/gallery',
+ buttonLabel: 'Check images',
+ seoTitle: 'Free Image SEO Checker',
+ seoDescription:
+ 'Images affect accessibility, page speed, search visibility, and layout stability. This checker extracts image tags from a page and highlights missing alt attributes, large known files, missing dimensions, lazy loading usage, and modern image formats.',
+ sections: [
+ {
+ title: 'What good image SEO looks like',
+ body: 'Meaningful images should have descriptive alt text, decorative images should use empty alt text, large images should be compressed, and dimensions should be set to reduce layout shift.',
+ },
+ {
+ title: 'Performance and accessibility together',
+ body: 'Image SEO is not only about image search. Smaller files improve load speed, and accurate alt text helps people using assistive technology understand the page.',
+ },
+ ],
+ faq: [
+ {
+ question: 'Should every image have alt text?',
+ answer:
+ 'Every img tag should have an alt attribute. Meaningful images need descriptive alt text, while decorative images should use an empty alt attribute.',
+ },
+ {
+ question: 'Are WebP and AVIF better for SEO?',
+ answer:
+ 'They are often smaller than JPEG or PNG, which can improve page speed. The format itself is not a ranking shortcut.',
+ },
+ {
+ question: 'Why do width and height attributes matter?',
+ answer:
+ 'They help browsers reserve layout space before the image loads, reducing layout shift and improving perceived quality.',
+ },
+ {
+ question: 'Can lazy loading hurt SEO?',
+ answer:
+ 'Native lazy loading is usually fine, but important above-the-fold images should load promptly and be available in the HTML.',
+ },
+ ],
+ },
+ 'internal-link-analyzer': {
+ title: 'Internal Link Analyzer',
+ metaTitle:
+ 'Free Internal Link Analyzer - Audit Anchors and Link Attributes',
+ metaDescription:
+ 'Analyze links on a page. Group internal and external links, anchor text, nofollow, sponsored, ugc, duplicate anchors, fragments, mailto, tel, and empty anchors.',
+ description:
+ 'Inspect a page link graph, anchor text, internal and external links, rel attributes, fragments, and empty anchors.',
+ inputLabel: 'Page URL',
+ placeholder: 'https://example.com/docs',
+ buttonLabel: 'Analyze links',
+ seoTitle: 'Free Internal Link Analyzer',
+ seoDescription:
+ 'Internal links help search engines discover pages and understand relationships between topics. This analyzer extracts links from a page and groups anchor text, rel attributes, fragments, mailto and tel links, and suspicious empty anchors.',
+ sections: [
+ {
+ title: 'Why internal links matter',
+ body: 'A clear internal link structure helps users keep moving and helps crawlers discover important pages. Descriptive anchors also explain what the linked page is about.',
+ },
+ {
+ title: 'What to review first',
+ body: 'Start with empty anchors, important pages with weak anchor text, repeated anchors pointing to different URLs, and internal links marked nofollow without a clear reason.',
+ },
+ ],
+ faq: [
+ {
+ question: 'What is good anchor text?',
+ answer:
+ 'Good anchor text is concise, descriptive, and specific enough that a user can understand where the link goes before clicking.',
+ },
+ {
+ question: 'Should internal links use nofollow?',
+ answer:
+ 'Usually no. Internal nofollow can make discovery and signal flow harder unless there is a specific technical reason.',
+ },
+ {
+ question: 'Are duplicate anchors bad?',
+ answer:
+ 'Not always. They are worth reviewing when the same anchor text points to multiple unrelated URLs because that can create ambiguity.',
+ },
+ {
+ question: 'Do mailto and tel links affect SEO?',
+ answer:
+ 'They are useful for users but are not crawlable page destinations. This tool separates them from internal and external web links.',
+ },
+ ],
+ },
+ 'ai-search-llm-crawlability-checker': {
+ title: 'AI Search / LLM Crawlability Checker',
+ metaTitle:
+ 'Free AI Search Crawlability Checker - Robots.txt, llms.txt and Schema',
+ metaDescription:
+ 'Check AI search and LLM crawlability signals. Audit robots.txt rules for common AI crawlers, llms.txt, llms-full.txt, sitemap, canonical, title, description, and structured data.',
+ description:
+ 'Check whether common AI crawlers can access a site and whether machine-readable discovery signals are present.',
+ inputLabel: 'Website URL',
+ placeholder: 'https://example.com',
+ buttonLabel: 'Check AI crawlability',
+ seoTitle: 'Free AI Search and LLM Crawlability Checker',
+ seoDescription:
+ 'AI search visibility depends on crawl access, clean canonical signals, readable page summaries, sitemaps, and structured data. This checker audits common robots.txt rules for AI crawlers and looks for emerging llms.txt files alongside classic SEO signals.',
+ sections: [
+ {
+ title: 'Signals this tool checks',
+ body: 'The scan checks robots.txt access for common AI crawlers, llms.txt and llms-full.txt presence, sitemap availability, canonical clarity, page title and description, and structured data presence.',
+ },
+ {
+ title: 'What each signal means',
+ body: 'Robots.txt controls crawl permission, llms.txt can summarize important content for AI tools, sitemaps help discovery, canonicals identify preferred URLs, and structured data describes entities in a machine-readable way.',
+ },
+ ],
+ faq: [
+ {
+ question: 'What is llms.txt?',
+ answer:
+ 'llms.txt is an emerging convention for publishing a concise, AI-friendly map of important site content. It is not a universal standard, but some teams use it to improve discoverability.',
+ },
+ {
+ question: 'Should I allow AI crawlers?',
+ answer:
+ 'That is a content and business decision. Some sites want AI visibility, while others prefer to restrict reuse. This tool shows the current technical signals.',
+ },
+ {
+ question: 'Does structured data help AI search?',
+ answer:
+ 'Structured data can help machines understand entities and page purpose. It is useful for classic search and may help AI retrieval systems interpret content.',
+ },
+ {
+ question: 'Is AI crawlability the same as SEO?',
+ answer:
+ 'They overlap, but they are not identical. AI systems may use different crawlers, retrieval pipelines, and summaries than traditional search engines.',
+ },
+ ],
+ },
+ 'gsc-export-analyzer': {
+ title: 'GSC Export Analyzer',
+ metaTitle: 'Free GSC Export Analyzer - Find SEO CTR and Ranking Quick Wins',
+ metaDescription:
+ 'Upload a Google Search Console CSV export and find high-impression low-CTR opportunities, declining pages, keyword cannibalization candidates, and quick-win pages.',
+ description:
+ 'Upload a Search Console CSV export and surface CTR opportunities, declining pages, cannibalization candidates, and quick wins.',
+ seoTitle: 'Free Google Search Console Export Analyzer',
+ seoDescription:
+ 'Search Console exports are packed with useful SEO work, but raw rows are hard to prioritize. This client-side analyzer groups query and page performance to reveal high-impression low-CTR rows, declining pages when date data exists, cannibalization candidates, and ranking quick wins.',
+ sections: [
+ {
+ title: 'What the CSV analyzer looks for',
+ body: 'It supports common columns such as query, page, clicks, impressions, CTR, position, and date. Results are calculated locally in your browser so the uploaded export does not need a server action.',
+ },
+ {
+ title: 'How to use the findings',
+ body: 'Rewrite snippets for high-impression low-CTR rows, refresh declining pages, consolidate cannibalized queries, and improve pages already ranking on positions 4 to 20.',
+ },
+ ],
+ faq: [
+ {
+ question: 'What Google Search Console export should I upload?',
+ answer:
+ 'Use a CSV export from the Performance report. Query, page, clicks, impressions, CTR, and position columns are supported, with date used when available.',
+ },
+ {
+ question: 'Is my GSC data uploaded to Swetrix?',
+ answer:
+ 'The analyzer runs in your browser. It reads the CSV file locally and does not need to send the export to a server action.',
+ },
+ {
+ question: 'What is a low-CTR opportunity?',
+ answer:
+ 'It is a row with meaningful impressions but fewer clicks than expected. These are often good candidates for better titles, descriptions, or search intent alignment.',
+ },
+ {
+ question: 'What is keyword cannibalization?',
+ answer:
+ 'Cannibalization happens when multiple pages compete for the same query. It is not always bad, but it deserves review when impressions or clicks are split across similar pages.',
+ },
+ ],
+ },
+ 'http-status-bulk-checker': {
+ title: 'HTTP Status Bulk Checker',
+ metaTitle: 'Free HTTP Status Bulk Checker - Check Multiple URLs Online',
+ metaDescription:
+ 'Paste multiple URLs and check HTTP status codes, final URLs, redirect counts, content types, errors, and CSV output. Safe request limit included.',
+ description:
+ 'Paste up to 50 URLs and check status codes, final URLs, redirect counts, content types, and CSV output.',
+ inputLabel: 'URLs',
+ placeholder: 'https://example.com\nhttps://example.com/pricing',
+ buttonLabel: 'Check statuses',
+ seoTitle: 'Free HTTP Status Bulk Checker',
+ seoDescription:
+ 'Bulk status checks make migrations, audits, and launch QA faster. Paste a list of URLs to find 200 responses, redirects, broken pages, server errors, content types, and unexpected final destinations in one report.',
+ sections: [
+ {
+ title: 'When to use a bulk status checker',
+ body: 'Use it before and after migrations, during content pruning, after CMS changes, and when analytics shows traffic landing on old or failing URLs.',
+ },
+ {
+ title: 'Why redirects are shown separately',
+ body: 'Redirects are not always problems, but they can hide slow chains, temporary status codes, or final URLs that do not match your intended canonical structure.',
+ },
+ ],
+ faq: [
+ {
+ question: 'How many URLs can I check at once?',
+ answer:
+ 'This tool checks up to 50 unique URLs per run to keep requests fast and safe.',
+ },
+ {
+ question: 'Does it follow redirects?',
+ answer:
+ 'Yes. It traces redirects, reports the final URL, and counts the number of redirect hops.',
+ },
+ {
+ question: 'Can I export the results?',
+ answer:
+ 'Yes. The result includes CSV output that you can copy or download from the page.',
+ },
+ {
+ question: 'Should every SEO page return 200?',
+ answer:
+ 'Indexable canonical pages should usually return 200. Redirects, 404s, and 410s can be correct for moved or removed URLs.',
+ },
+ ],
+ },
+ 'seo-migration-redirect-validator': {
+ title: 'SEO Migration Redirect Validator',
+ metaTitle:
+ 'Free SEO Migration Redirect Validator - Check Old to New URL Redirects',
+ metaDescription:
+ 'Validate SEO migration redirects from old URL to new URL pairs. Check expected final targets, status code type, chain length, query preservation, mismatches, and CSV output.',
+ description:
+ 'Paste old URL,new URL pairs and verify permanent redirects, final targets, chain length, and query preservation.',
+ inputLabel: 'Old URL,new URL pairs',
+ placeholder:
+ 'https://old.example.com/page,https://new.example.com/page\nhttps://old.example.com/pricing,https://new.example.com/pricing',
+ buttonLabel: 'Validate redirects',
+ seoTitle: 'Free SEO Migration Redirect Validator',
+ seoDescription:
+ 'URL migrations fail when old URLs redirect to the wrong target, use temporary status codes, drop parameters, or create long chains. This validator checks old-to-new pairs so you can confirm that important pages preserve SEO signals after a migration.',
+ sections: [
+ {
+ title: 'What a healthy migration redirect looks like',
+ body: 'A healthy migration redirect uses a permanent status such as 301 or 308, reaches the expected new URL, keeps the chain short, and preserves query parameters when those parameters matter.',
+ },
+ {
+ title: 'Use analytics to choose the URL list',
+ body: 'Validate the URLs that actually receive visits, links, revenue, or search clicks first. Analytics and Search Console exports make that priority list much more useful than a raw crawl alone.',
+ },
+ ],
+ faq: [
+ {
+ question: 'Should SEO migrations use 301 redirects?',
+ answer:
+ 'Permanent migrations usually use 301 or 308 redirects. Temporary redirects can be valid for short-term tests, but they are not the usual choice for permanent URL moves.',
+ },
+ {
+ question: 'How long is too long for a redirect chain?',
+ answer:
+ 'Aim for one hop from old URL to new URL. More than two or three hops should usually be cleaned up.',
+ },
+ {
+ question: 'Should query parameters be preserved?',
+ answer:
+ 'Often yes, especially for campaign tracking and filtered landing pages. Some migrations intentionally drop parameters, but that should be explicit.',
+ },
+ {
+ question: 'What format should I paste?',
+ answer:
+ 'Paste one pair per line as old URL,new URL. A header row such as old,new is allowed.',
+ },
+ ],
+ },
+ 'uptime-sla-calculator': {
+ title: 'Uptime SLA Calculator',
+ metaTitle: 'Free Uptime SLA Calculator - Downtime and Availability Tool',
+ metaDescription:
+ 'Calculate uptime percentage, downtime allowance, monthly SLA targets, availability from incident minutes, and hosting reliability impact.',
+ description:
+ 'Convert uptime targets into allowed downtime and calculate real availability from incident minutes across monthly, quarterly, or yearly periods.',
+ seoTitle: 'Free Uptime SLA Calculator',
+ seoDescription:
+ 'Uptime targets are easier to understand when they are converted into minutes of downtime. This calculator helps hosting teams, SaaS founders, and website owners compare promised SLA numbers with real outages.',
+ sections: [
+ {
+ title: 'Why uptime belongs next to analytics',
+ body: 'A traffic drop is not always a marketing problem. Outages, partial downtime, DNS failures, and certificate issues can all reduce visits and conversions before a campaign has a chance to work.',
+ },
+ {
+ title: 'Common SLA targets',
+ body: '99% uptime allows much more downtime than 99.9%, and 99.99% is a different operating discipline again. Use the calculator to translate each target into monthly minutes.',
+ },
+ ],
+ faq: [
+ {
+ question: 'How do you calculate uptime percentage?',
+ answer:
+ 'Uptime percentage is calculated as available minutes divided by total minutes in the period, multiplied by 100.',
+ },
+ {
+ question: 'How much downtime does 99.9% uptime allow?',
+ answer:
+ 'In a 30 day month, 99.9% uptime allows about 43.2 minutes of downtime.',
+ },
+ {
+ question: 'What is the difference between uptime and availability?',
+ answer:
+ 'They are often used together. Uptime usually refers to whether the service is reachable, while availability can include whether critical functions are working correctly.',
+ },
+ {
+ question: 'Can downtime affect SEO?',
+ answer:
+ 'Short outages usually have limited SEO impact, but repeated or extended downtime can affect crawling, user signals, and revenue.',
+ },
+ {
+ question: 'Can Swetrix help explain traffic drops?',
+ answer:
+ 'Yes. Swetrix combines traffic, performance, errors, and alerts so you can connect reliability issues with user behavior.',
+ },
+ ],
+ },
+ 'website-bandwidth-calculator': {
+ title: 'Website Bandwidth Calculator',
+ metaTitle:
+ 'Free Website Bandwidth Calculator - Estimate Hosting Traffic Usage',
+ metaDescription:
+ 'Estimate monthly website bandwidth from visits, pages per visit, page weight, cache hit rate, and traffic growth. Useful for hosting, CDN, and analytics planning.',
+ description:
+ 'Estimate monthly hosting bandwidth from visits, pages per visit, average page weight, cache hit rate, and expected traffic growth.',
+ seoTitle: 'Free Website Bandwidth Calculator',
+ seoDescription:
+ 'Bandwidth planning helps you choose hosting plans, estimate CDN usage, and understand how growth affects infrastructure cost. This calculator turns traffic assumptions into monthly GB and average Mbps estimates.',
+ sections: [
+ {
+ title: 'How to estimate bandwidth',
+ body: 'Monthly bandwidth depends on page views, transferred page weight, caching, and growth. Use real analytics data when available, then add a growth margin for campaigns or launches.',
+ },
+ {
+ title: 'Why analytics data helps hosting decisions',
+ body: 'Traffic volume, top pages, geography, and campaign spikes all influence bandwidth. Analytics helps you size hosting from actual behavior instead of rough guesses.',
+ },
+ ],
+ faq: [
+ {
+ question: 'What is website bandwidth?',
+ answer:
+ 'Website bandwidth is the amount of data transferred from your server or CDN to visitors over a period of time.',
+ },
+ {
+ question: 'How do I find my average page weight?',
+ answer:
+ 'Use a page size checker, browser devtools, or a performance audit. Include HTML, CSS, JavaScript, images, fonts, and other assets that load during a visit.',
+ },
+ {
+ question: 'Does caching reduce bandwidth?',
+ answer:
+ 'Yes. Browser and CDN caching can reduce repeated transfers, especially for static assets such as images, scripts, and stylesheets.',
+ },
+ {
+ question: 'How much bandwidth do I need for 100,000 visits?',
+ answer:
+ 'It depends on pages per visit and page weight. For example, 100,000 visits with 2 pages per visit and 1 MB transferred per page uses about 195 GB before caching adjustments.',
+ },
+ {
+ question: 'Can Swetrix provide the traffic inputs?',
+ answer:
+ 'Yes. Swetrix shows visits, page views, top pages, referrers, countries, and campaign data that help you estimate real bandwidth needs.',
+ },
+ ],
+ },
+}
+
+const ISSUE_STYLES: Record<IssueLevel, string> = {
+ good: 'bg-emerald-50 text-emerald-700 ring-emerald-200 dark:bg-emerald-500/10 dark:text-emerald-300 dark:ring-emerald-500/25',
+ warning:
+ 'bg-amber-50 text-amber-800 ring-amber-200 dark:bg-amber-500/10 dark:text-amber-300 dark:ring-amber-500/25',
+ error:
+ 'bg-red-50 text-red-700 ring-red-200 dark:bg-red-500/10 dark:text-red-300 dark:ring-red-500/25',
+ info: 'bg-sky-50 text-sky-700 ring-sky-200 dark:bg-sky-500/10 dark:text-sky-300 dark:ring-sky-500/25',
+}
+
+function IssueIcon({ level }: { level: IssueLevel }) {
+ if (level === 'good') return <CheckCircleIcon className='size-4' />
+ if (level === 'error') return <XCircleIcon className='size-4' />
+ return <WarningCircleIcon className='size-4' />
+}
+
+function ResultPanel({ children }: { children: ReactNode }) {
+ return (
+ <div className='mt-8 rounded-lg bg-white p-6 ring-1 ring-gray-200 dark:bg-slate-950 dark:ring-slate-800'>
+ {children}
+ </div>
+ )
+}
+
+function MetricGrid({
+ items,
+}: {
+ items: Array<{ label: string; value: ReactNode; hint?: ReactNode }>
+}) {
+ return (
+ <div className='grid gap-3 sm:grid-cols-2 xl:grid-cols-4'>
+ {items.map((item) => (
+ <div
+ key={item.label}
+ className='rounded-lg bg-gray-50 p-4 ring-1 ring-gray-200/80 dark:bg-slate-900 dark:ring-slate-800'
+ >
+ <Text
+ as='p'
+ size='xs'
+ weight='medium'
+ colour='muted'
+ className='uppercase'
+ >
+ {item.label}
+ </Text>
+ <div className='mt-2 text-2xl font-semibold tracking-tight text-slate-900 dark:text-white'>
+ {item.value}
+ </div>
+ {item.hint ? (
+ <Text as='p' size='xs' colour='muted' className='mt-1'>
+ {item.hint}
+ </Text>
+ ) : null}
+ </div>
+ ))}
+ </div>
+ )
+}
+
+function KeyValueList({
+ items,
+}: {
+ items: Array<{ label: string; value: ReactNode; mono?: boolean }>
+}) {
+ return (
+ <dl className='divide-y divide-gray-100 border-y border-gray-100 dark:divide-slate-800 dark:border-slate-800'>
+ {items.map((item) =>
+ item.value === null ||
+ item.value === undefined ||
+ item.value === '' ? null : (
+ <div
+ key={item.label}
+ className='grid gap-1 py-3 sm:grid-cols-[180px_1fr] sm:gap-6'
+ >
+ <dt className='text-sm text-gray-500 dark:text-slate-400'>
+ {item.label}
+ </dt>
+ <dd
+ className={cn(
+ 'min-w-0 text-sm font-medium wrap-break-word text-slate-900 dark:text-white',
+ item.mono && 'font-mono tabular-nums',
+ )}
+ >
+ {item.value}
</dd>
</div>
),
@@ -883,32 +1691,121 @@ function ServerTool({
const fetcher = useFetcher()
const data = fetcher.data as ToolActionData | undefined
const isLoading = fetcher.state !== 'idle'
+ const [bulkUrls, setBulkUrls] = useState('')
+ const [migrationPairs, setMigrationPairs] = useState('')
return (
<div className='mt-10'>
<div className='rounded-lg bg-white p-6 ring-1 ring-gray-200 dark:bg-slate-950 dark:ring-slate-800'>
- <fetcher.Form
- method='post'
- className='flex flex-col gap-3 sm:flex-row sm:items-end'
- >
- <Input
- name='value'
- type='text'
- label={config.inputLabel}
- placeholder={config.placeholder}
- className='sm:flex-1'
- spellCheck={false}
- autoCapitalize='off'
- autoComplete='off'
- required
- />
- <Button type='submit' loading={isLoading} disabled={isLoading}>
- {isLoading ? null : (
- <MagnifyingGlassIcon className='mr-1.5 size-4' />
- )}
- {config.buttonLabel}
- </Button>
- </fetcher.Form>
+ {slug === 'robots-txt-tester' ? (
+ <fetcher.Form method='post' className='grid gap-4 lg:grid-cols-3'>
+ <Input
+ name='robotsUrl'
+ type='text'
+ label='Website or robots.txt URL'
+ placeholder='https://example.com'
+ spellCheck={false}
+ autoCapitalize='off'
+ autoComplete='off'
+ required
+ />
+ <Input
+ name='path'
+ type='text'
+ label='Path to test'
+ placeholder='/blog/post'
+ defaultValue='/'
+ spellCheck={false}
+ autoCapitalize='off'
+ autoComplete='off'
+ required
+ />
+ <Input
+ name='userAgent'
+ type='text'
+ label='User agent'
+ placeholder='Googlebot'
+ defaultValue='Googlebot'
+ spellCheck={false}
+ autoCapitalize='off'
+ autoComplete='off'
+ required
+ />
+ <div className='lg:col-span-3'>
+ <Button type='submit' loading={isLoading} disabled={isLoading}>
+ {isLoading ? null : (
+ <MagnifyingGlassIcon className='mr-1.5 size-4' />
+ )}
+ {config.buttonLabel}
+ </Button>
+ </div>
+ </fetcher.Form>
+ ) : slug === 'http-status-bulk-checker' ? (
+ <fetcher.Form method='post' className='space-y-4'>
+ <Textarea
+ name='urls'
+ label={config.inputLabel}
+ placeholder={config.placeholder}
+ rows={8}
+ value={bulkUrls}
+ onChange={(event) => setBulkUrls(event.target.value)}
+ spellCheck={false}
+ autoCapitalize='off'
+ autoComplete='off'
+ required
+ />
+ <Button type='submit' loading={isLoading} disabled={isLoading}>
+ {isLoading ? null : (
+ <MagnifyingGlassIcon className='mr-1.5 size-4' />
+ )}
+ {config.buttonLabel}
+ </Button>
+ </fetcher.Form>
+ ) : slug === 'seo-migration-redirect-validator' ? (
+ <fetcher.Form method='post' className='space-y-4'>
+ <Textarea
+ name='pairs'
+ label={config.inputLabel}
+ placeholder={config.placeholder}
+ rows={8}
+ value={migrationPairs}
+ onChange={(event) => setMigrationPairs(event.target.value)}
+ spellCheck={false}
+ autoCapitalize='off'
+ autoComplete='off'
+ required
+ />
+ <Button type='submit' loading={isLoading} disabled={isLoading}>
+ {isLoading ? null : (
+ <MagnifyingGlassIcon className='mr-1.5 size-4' />
+ )}
+ {config.buttonLabel}
+ </Button>
+ </fetcher.Form>
+ ) : (
+ <fetcher.Form
+ method='post'
+ className='flex flex-col gap-3 sm:flex-row sm:items-end'
+ >
+ <Input
+ name='value'
+ type='text'
+ label={config.inputLabel}
+ placeholder={config.placeholder}
+ className='sm:flex-1'
+ spellCheck={false}
+ autoCapitalize='off'
+ autoComplete='off'
+ required
+ />
+ <Button type='submit' loading={isLoading} disabled={isLoading}>
+ {isLoading ? null : (
+ <MagnifyingGlassIcon className='mr-1.5 size-4' />
+ )}
+ {config.buttonLabel}
+ </Button>
+ </fetcher.Form>
+ )}
</div>
{data?.error ? (
@@ -946,6 +1843,38 @@ function renderServerResult(slug: ServerToolSlug, result: unknown) {
if (slug === 'page-size-checker') {
return <PageSizeResultView result={result as PageSizeResult} />
}
+ if (slug === 'indexability-checker') {
+ return <IndexabilityResultView result={result as IndexabilityResult} />
+ }
+ if (slug === 'robots-txt-tester') {
+ return <RobotsTesterResultView result={result as RobotsTesterResult} />
+ }
+ if (slug === 'broken-link-checker') {
+ return <BrokenLinkResultView result={result as BrokenLinkResult} />
+ }
+ if (slug === 'hreflang-checker') {
+ return <HreflangResultView result={result as HreflangResult} />
+ }
+ if (slug === 'on-page-seo-checker') {
+ return <OnPageSeoResultView result={result as OnPageSeoResult} />
+ }
+ if (slug === 'image-seo-checker') {
+ return <ImageSeoResultView result={result as ImageSeoResult} />
+ }
+ if (slug === 'internal-link-analyzer') {
+ return <InternalLinkResultView result={result as InternalLinkResult} />
+ }
+ if (slug === 'ai-search-llm-crawlability-checker') {
+ return <AiCrawlabilityResultView result={result as AiCrawlabilityResult} />
+ }
+ if (slug === 'http-status-bulk-checker') {
+ return <BulkStatusResultView result={result as BulkStatusResult} />
+ }
+ if (slug === 'seo-migration-redirect-validator') {
+ return (
+ <MigrationRedirectResultView result={result as MigrationRedirectResult} />
+ )
+ }
return null
}
@@ -984,51 +1913,346 @@ function HeaderResultView({ result }: { result: HeaderResult }) {
/>
<IssueList issues={result.issues} />
<DataTable
- columns={['Header', 'Value']}
- rows={result.importantHeaders.map((header) => [
- mono(header.name),
- header.value ? mono(header.value) : mutedCell('Missing'),
+ columns={['Header', 'Value']}
+ rows={result.importantHeaders.map((header) => [
+ mono(header.name),
+ header.value ? mono(header.value) : mutedCell('Missing'),
+ ])}
+ />
+ </ResultPanel>
+ )
+}
+
+function SslResultView({ result }: { result: SslResult }) {
+ const status = result.isExpired
+ ? 'Expired'
+ : result.expiresSoon
+ ? 'Expires soon'
+ : result.authorized
+ ? 'Valid'
+ : 'Needs review'
+
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Host', value: result.host },
+ { label: 'Status', value: status },
+ { label: 'Days remaining', value: result.daysRemaining },
+ { label: 'Authorized', value: result.authorized ? 'Yes' : 'No' },
+ ]}
+ />
+ <div className='mt-6'>
+ <KeyValueList
+ items={[
+ { label: 'Valid from', value: formatDate(result.validFrom) },
+ { label: 'Valid to', value: formatDate(result.validTo) },
+ { label: 'Subject', value: formatHostObject(result.subject) },
+ { label: 'Issuer', value: formatHostObject(result.issuer) },
+ {
+ label: 'Subject alternative names',
+ value: result.subjectAltName,
+ },
+ { label: 'Authorization error', value: result.authorizationError },
+ { label: 'Serial number', value: result.serialNumber, mono: true },
+ {
+ label: 'SHA-256 fingerprint',
+ value: result.fingerprint256,
+ mono: true,
+ },
+ ]}
+ />
+ </div>
+ </ResultPanel>
+ )
+}
+
+function RedirectResultView({ result }: { result: RedirectResult }) {
+ const issues: Issue[] = result.hasLoopRisk
+ ? [
+ {
+ level: 'warning',
+ message: 'Redirect chain reached the scan limit',
+ details:
+ 'The URL may have a loop or a very long chain. Review the redirect rules on your host or CDN.',
+ },
+ ]
+ : result.redirectCount > 2
+ ? [
+ {
+ level: 'warning',
+ message: 'Redirect chain is longer than ideal',
+ details:
+ 'Shorter chains are faster and easier for crawlers to follow.',
+ },
+ ]
+ : [
+ {
+ level: 'good',
+ message: 'Redirect chain length looks reasonable',
+ details:
+ 'The URL reached its final destination within a short chain.',
+ },
+ ]
+
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Redirects', value: result.redirectCount },
+ { label: 'Steps', value: result.chain.length },
+ { label: 'Final URL', value: result.finalUrl },
+ { label: 'Loop risk', value: result.hasLoopRisk ? 'Review' : 'No' },
+ ]}
+ />
+ <IssueList issues={issues} />
+ <DataTable
+ columns={['Step', 'Status', 'URL', 'Next']}
+ rows={result.chain.map((step, index) => [
+ mono(index + 1),
+ mono(`${step.status} ${step.statusText}`),
+ mono(step.url),
+ step.location ? mono(step.location) : mutedCell('Final'),
+ ])}
+ />
+ </ResultPanel>
+ )
+}
+
+function CookieResultView({ result }: { result: CookieResult }) {
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Cookies', value: result.cookieCount },
+ { label: 'Status', value: result.status },
+ { label: 'Final URL', value: result.finalUrl },
+ {
+ label: 'Secure cookies',
+ value: result.cookies.filter((cookie) => cookie.secure).length,
+ },
+ ]}
+ />
+ <IssueList issues={result.issues} />
+ {result.cookies.length ? (
+ <DataTable
+ columns={[
+ 'Name',
+ 'Secure',
+ 'HttpOnly',
+ 'SameSite',
+ 'Domain',
+ 'Expires',
+ ]}
+ rows={result.cookies.map((cookie) => [
+ mono(String(cookie.name || '')),
+ cookie.secure ? 'Yes' : 'No',
+ cookie.httpOnly ? 'Yes' : 'No',
+ String(cookie.sameSite || 'Missing'),
+ mono(String(cookie.domain || cookie.path || 'Host only')),
+ cookie.expires || cookie.maxAge || 'Session',
+ ])}
+ />
+ ) : null}
+ </ResultPanel>
+ )
+}
+
+function CspResultView({ result }: { result: CspResult }) {
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Status', value: result.status },
+ { label: 'CSP header', value: result.csp ? 'Present' : 'Missing' },
+ {
+ label: 'Directives',
+ value: Object.keys(result.directives).length,
+ },
+ { label: 'Report only', value: result.reportOnly ? 'Yes' : 'No' },
+ ]}
+ />
+ <IssueList issues={result.issues} />
+ {result.csp ? (
+ <div className='mt-6'>
+ <Text as='h3' size='lg' weight='semibold' className='mb-3'>
+ Policy header
+ </Text>
+ <CodeBlock code={`Content-Security-Policy: ${result.csp}`} />
+ </div>
+ ) : null}
+ <DataTable
+ columns={['Header', 'Value']}
+ rows={Object.entries(result.securityHeaders).map(([name, value]) => [
+ mono(name),
+ value ? mono(value) : mutedCell('Missing'),
+ ])}
+ />
+ </ResultPanel>
+ )
+}
+
+function CanonicalResultView({ result }: { result: CanonicalResult }) {
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Status', value: result.status },
+ {
+ label: 'Canonical',
+ value: result.absoluteCanonical ? 'Present' : 'Missing',
+ },
+ { label: 'Robots', value: result.robots || 'Default' },
+ { label: 'Final URL', value: result.finalUrl },
+ ]}
+ />
+ <IssueList issues={result.issues} />
+ <div className='mt-6'>
+ <KeyValueList
+ items={[
+ { label: 'Title', value: result.title },
+ { label: 'Description', value: result.description },
+ { label: 'Canonical tag', value: result.canonical, mono: true },
+ {
+ label: 'Canonical resolved',
+ value: result.absoluteCanonical,
+ mono: true,
+ },
+ { label: 'Open Graph URL', value: result.ogUrl, mono: true },
+ { label: 'Requested URL', value: result.requestedUrl, mono: true },
+ ]}
+ />
+ </div>
+ </ResultPanel>
+ )
+}
+
+function PageSizeResultView({ result }: { result: PageSizeResult }) {
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Known size', value: result.totalKnownSize },
+ { label: 'HTML size', value: result.htmlSize },
+ { label: 'Resources', value: result.resourceCount },
+ { label: 'Scan time', value: `${result.scanTime} ms` },
+ ]}
+ />
+ <IssueList issues={result.issues} />
+ <DataTable
+ columns={['Category', 'Resources', 'Known size']}
+ rows={result.categories.map((category) => [
+ category.category,
+ mono(category.count),
+ mono(category.size),
])}
/>
+ {result.largestResources.length ? (
+ <>
+ <Text as='h3' size='lg' weight='semibold' className='mt-8'>
+ Largest detected resources
+ </Text>
+ <DataTable
+ columns={['Size', 'Type', 'URL']}
+ rows={result.largestResources.map((resource) => [
+ mono(resource.size),
+ resource.category,
+ mono(resource.url),
+ ])}
+ />
+ </>
+ ) : null}
</ResultPanel>
)
}
-function SslResultView({ result }: { result: SslResult }) {
- const status = result.isExpired
- ? 'Expired'
- : result.expiresSoon
- ? 'Expires soon'
- : result.authorized
- ? 'Valid'
- : 'Needs review'
+function statusValue(value: number | null) {
+ return value === null ? 'Failed' : value
+}
+
+function yesNo(value: boolean) {
+ return value ? 'Yes' : 'No'
+}
+
+function DownloadCsvButton({
+ csv,
+ filename,
+}: {
+ csv: string
+ filename: string
+}) {
+ const download = () => {
+ const blob = new Blob([csv], { type: 'text/csv;charset=utf-8' })
+ const url = URL.createObjectURL(blob)
+ const link = document.createElement('a')
+
+ link.href = url
+ link.download = filename
+ link.click()
+ URL.revokeObjectURL(url)
+ }
+
+ return (
+ <Button type='button' variant='secondary' onClick={download}>
+ <DownloadSimpleIcon className='mr-1.5 size-4' />
+ Download CSV
+ </Button>
+ )
+}
+function IndexabilityResultView({ result }: { result: IndexabilityResult }) {
return (
<ResultPanel>
<MetricGrid
items={[
- { label: 'Host', value: result.host },
- { label: 'Status', value: status },
- { label: 'Days remaining', value: result.daysRemaining },
- { label: 'Authorized', value: result.authorized ? 'Yes' : 'No' },
+ { label: 'Verdict', value: result.indexability },
+ { label: 'Status', value: result.status },
+ {
+ label: 'Robots.txt',
+ value: result.robotsTxt.allowed ? 'Allowed' : 'Blocked',
+ },
+ {
+ label: 'Canonical',
+ value: result.absoluteCanonical ? 'Present' : 'Missing',
+ },
]}
/>
+ <IssueList issues={result.issues} />
<div className='mt-6'>
<KeyValueList
items={[
- { label: 'Valid from', value: formatDate(result.validFrom) },
- { label: 'Valid to', value: formatDate(result.validTo) },
- { label: 'Subject', value: formatHostObject(result.subject) },
- { label: 'Issuer', value: formatHostObject(result.issuer) },
+ { label: 'Final URL', value: result.finalUrl, mono: true },
+ { label: 'Title', value: result.title },
+ { label: 'Description', value: result.description },
+ { label: 'Meta robots', value: result.metaRobots || 'Default' },
{
- label: 'Subject alternative names',
- value: result.subjectAltName,
+ label: 'X-Robots-Tag',
+ value: result.xRobotsTag || 'Not set',
},
- { label: 'Authorization error', value: result.authorizationError },
- { label: 'Serial number', value: result.serialNumber, mono: true },
{
- label: 'SHA-256 fingerprint',
- value: result.fingerprint256,
+ label: 'Canonical tag',
+ value: result.canonical,
+ mono: true,
+ },
+ {
+ label: 'Canonical resolved',
+ value: result.absoluteCanonical,
+ mono: true,
+ },
+ {
+ label: 'Robots.txt URL',
+ value: result.robotsTxt.url,
+ mono: true,
+ },
+ {
+ label: 'Robots matched rule',
+ value: result.robotsTxt.matchedRule
+ ? `${result.robotsTxt.matchedRule.directive}: ${result.robotsTxt.matchedRule.path}`
+ : 'No matching block',
+ },
+ {
+ label: 'Sitemap hint',
+ value: result.sitemapHint,
mono: true,
},
]}
@@ -1038,159 +2262,362 @@ function SslResultView({ result }: { result: SslResult }) {
)
}
-function RedirectResultView({ result }: { result: RedirectResult }) {
- const issues: Issue[] = result.hasLoopRisk
- ? [
- {
- level: 'warning',
- message: 'Redirect chain reached the scan limit',
- details:
- 'The URL may have a loop or a very long chain. Review the redirect rules on your host or CDN.',
- },
- ]
- : result.redirectCount > 2
- ? [
- {
- level: 'warning',
- message: 'Redirect chain is longer than ideal',
- details:
- 'Shorter chains are faster and easier for crawlers to follow.',
- },
- ]
- : [
- {
- level: 'good',
- message: 'Redirect chain length looks reasonable',
- details:
- 'The URL reached its final destination within a short chain.',
- },
- ]
+function RobotsTesterResultView({ result }: { result: RobotsTesterResult }) {
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Result', value: result.allowed ? 'Allowed' : 'Blocked' },
+ { label: 'User agent', value: result.userAgent },
+ { label: 'Path', value: result.path },
+ { label: 'Sitemaps', value: result.sitemaps.length },
+ ]}
+ />
+ <IssueList issues={result.issues} />
+ <DataTable
+ columns={['Crawler', 'Allowed', 'Matched rule', 'Group']}
+ rows={result.tests.map((test) => [
+ mono(test.userAgent),
+ yesNo(test.allowed),
+ test.matchedRule
+ ? mono(`${test.matchedRule.directive}: ${test.matchedRule.path}`)
+ : mutedCell('No rule'),
+ test.groupAgents.length
+ ? mono(test.groupAgents.join(', '))
+ : mutedCell('Default allow'),
+ ])}
+ />
+ {result.sitemaps.length ? (
+ <div className='mt-6'>
+ <Text as='h3' size='lg' weight='semibold'>
+ Sitemap hints
+ </Text>
+ <DataTable
+ columns={['Sitemap URL']}
+ rows={result.sitemaps
+ .slice(0, 10)
+ .map((sitemap) => [mono(sitemap)])}
+ />
+ </div>
+ ) : null}
+ </ResultPanel>
+ )
+}
+function BrokenLinkResultView({ result }: { result: BrokenLinkResult }) {
return (
<ResultPanel>
<MetricGrid
items={[
+ { label: 'Checked', value: result.checkedLinks },
+ { label: 'Broken', value: result.brokenCount },
{ label: 'Redirects', value: result.redirectCount },
- { label: 'Steps', value: result.chain.length },
- { label: 'Final URL', value: result.finalUrl },
- { label: 'Loop risk', value: result.hasLoopRisk ? 'Review' : 'No' },
+ { label: 'Empty anchors', value: result.emptyAnchorCount },
]}
/>
- <IssueList issues={issues} />
+ <IssueList issues={result.issues} />
<DataTable
- columns={['Step', 'Status', 'URL', 'Next']}
- rows={result.chain.map((step, index) => [
- mono(index + 1),
- mono(`${step.status} ${step.statusText}`),
- mono(step.url),
- step.location ? mono(step.location) : mutedCell('Final'),
- ])}
+ columns={['Issue', 'Status', 'Type', 'Anchor', 'URL']}
+ rows={result.links
+ .filter((link) => link.issue !== 'OK')
+ .concat(result.links.filter((link) => link.issue === 'OK'))
+ .slice(0, 40)
+ .map((link) => [
+ link.issue,
+ mono(statusValue(link.status)),
+ link.kind,
+ link.anchor || mutedCell('Empty'),
+ mono(link.url),
+ ])}
/>
+ {result.invalidLinks.length ? (
+ <>
+ <Text as='h3' size='lg' weight='semibold' className='mt-8'>
+ Invalid links
+ </Text>
+ <DataTable
+ columns={['Issue', 'Href', 'Anchor']}
+ rows={result.invalidLinks.map((link) => [
+ link.issue,
+ link.href ? mono(link.href) : mutedCell('Missing'),
+ link.anchor || mutedCell('Empty'),
+ ])}
+ />
+ </>
+ ) : null}
</ResultPanel>
)
}
-function CookieResultView({ result }: { result: CookieResult }) {
+function HreflangResultView({ result }: { result: HreflangResult }) {
return (
<ResultPanel>
<MetricGrid
items={[
- { label: 'Cookies', value: result.cookieCount },
- { label: 'Status', value: result.status },
- { label: 'Final URL', value: result.finalUrl },
+ { label: 'Hreflang tags', value: result.tags.length },
+ { label: 'Invalid', value: result.invalidCount },
+ { label: 'Duplicates', value: result.duplicateCount },
{
- label: 'Secure cookies',
- value: result.cookies.filter((cookie) => cookie.secure).length,
+ label: 'x-default',
+ value: result.hasXDefault ? 'Present' : 'Missing',
},
]}
/>
<IssueList issues={result.issues} />
- {result.cookies.length ? (
+ {result.tags.length ? (
<DataTable
- columns={[
- 'Name',
- 'Secure',
- 'HttpOnly',
- 'SameSite',
- 'Domain',
- 'Expires',
- ]}
- rows={result.cookies.map((cookie) => [
- mono(String(cookie.name || '')),
- cookie.secure ? 'Yes' : 'No',
- cookie.httpOnly ? 'Yes' : 'No',
- String(cookie.sameSite || 'Missing'),
- mono(String(cookie.domain || cookie.path || 'Host only')),
- cookie.expires || cookie.maxAge || 'Session',
+ columns={['Hreflang', 'URL', 'Absolute']}
+ rows={result.tags.map((tag) => [
+ tag.hreflang ? mono(tag.hreflang) : mutedCell('Missing'),
+ tag.absoluteUrl ? mono(tag.absoluteUrl) : mutedCell('Invalid URL'),
+ yesNo(tag.isAbsolute),
])}
/>
) : null}
+ {result.reciprocalChecks.length ? (
+ <>
+ <Text as='h3' size='lg' weight='semibold' className='mt-8'>
+ Reciprocal checks
+ </Text>
+ <DataTable
+ columns={['URL', 'Status', 'Return tag']}
+ rows={result.reciprocalChecks.map((check) => [
+ check.url ? mono(check.url) : mutedCell('Missing'),
+ mono(statusValue(check.status)),
+ check.error
+ ? check.error
+ : check.hasReturnTag
+ ? 'Found'
+ : 'Missing',
+ ])}
+ />
+ </>
+ ) : null}
</ResultPanel>
)
}
-function CspResultView({ result }: { result: CspResult }) {
+function OnPageSeoResultView({ result }: { result: OnPageSeoResult }) {
return (
<ResultPanel>
<MetricGrid
items={[
- { label: 'Status', value: result.status },
- { label: 'CSP header', value: result.csp ? 'Present' : 'Missing' },
- {
- label: 'Directives',
- value: Object.keys(result.directives).length,
- },
- { label: 'Report only', value: result.reportOnly ? 'Yes' : 'No' },
+ { label: 'Words', value: result.wordCount },
+ { label: 'H1 headings', value: result.h1.length },
+ { label: 'Internal links', value: result.internalLinks },
+ { label: 'Text to HTML', value: `${result.textHtmlRatio}%` },
]}
/>
<IssueList issues={result.issues} />
- {result.csp ? (
- <div className='mt-6'>
- <Text as='h3' size='lg' weight='semibold' className='mb-3'>
- Policy header
+ <div className='mt-6'>
+ <KeyValueList
+ items={[
+ {
+ label: 'Title',
+ value: result.title
+ ? `${result.title} (${result.titleLength} characters)`
+ : null,
+ },
+ {
+ label: 'Description',
+ value: result.description
+ ? `${result.description} (${result.descriptionLength} characters)`
+ : null,
+ },
+ { label: 'Canonical', value: result.canonical, mono: true },
+ { label: 'Robots', value: result.robots || 'Default' },
+ {
+ label: 'Images',
+ value: `${result.imageCount} total, ${result.imagesMissingAlt} missing alt, ${result.imagesEmptyAlt} empty alt`,
+ },
+ {
+ label: 'Links',
+ value: `${result.internalLinks} internal, ${result.externalLinks} external`,
+ },
+ {
+ label: 'Structured data',
+ value: result.structuredDataCount,
+ },
+ { label: 'Open Graph tags', value: result.openGraphCount },
+ ]}
+ />
+ </div>
+ <div className='mt-8 grid gap-6 md:grid-cols-2'>
+ <div>
+ <Text as='h3' size='lg' weight='semibold'>
+ H1 headings
</Text>
- <CodeBlock code={`Content-Security-Policy: ${result.csp}`} />
+ <DataTable
+ columns={['Heading']}
+ rows={
+ result.h1.length
+ ? result.h1.map((heading) => [heading])
+ : [[mutedCell('No H1 found')]]
+ }
+ />
</div>
+ <div>
+ <Text as='h3' size='lg' weight='semibold'>
+ H2 sample
+ </Text>
+ <DataTable
+ columns={['Heading']}
+ rows={
+ result.h2.length
+ ? result.h2.map((heading) => [heading])
+ : [[mutedCell('No H2 headings found')]]
+ }
+ />
+ </div>
+ </div>
+ </ResultPanel>
+ )
+}
+
+function ImageSeoResultView({ result }: { result: ImageSeoResult }) {
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Images', value: result.imageCount },
+ { label: 'Missing alt', value: result.missingAlt },
+ { label: 'Large images', value: result.largeImages },
+ { label: 'Lazy loaded', value: result.lazyImages },
+ ]}
+ />
+ <IssueList issues={result.issues} />
+ {result.images.length ? (
+ <DataTable
+ columns={['Size', 'Alt', 'Dimensions', 'Loading', 'Format', 'URL']}
+ rows={result.images.map((image) => [
+ mono(image.size),
+ !image.hasAlt ? 'Missing' : image.alt ? image.alt : 'Empty alt',
+ image.hasDimensions
+ ? `${image.width} x ${image.height}`
+ : 'Missing',
+ image.loading || 'Default',
+ image.format,
+ image.src ? mono(image.src) : mutedCell('Missing source'),
+ ])}
+ />
) : null}
+ </ResultPanel>
+ )
+}
+
+function InternalLinkResultView({ result }: { result: InternalLinkResult }) {
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Total links', value: result.totalLinks },
+ { label: 'Internal', value: result.internalCount },
+ { label: 'External', value: result.externalCount },
+ { label: 'Empty anchors', value: result.emptyAnchorCount },
+ ]}
+ />
+ <IssueList issues={result.issues} />
+ <div className='mt-6'>
+ <MetricGrid
+ items={[
+ { label: 'Nofollow', value: result.nofollowCount },
+ { label: 'Sponsored', value: result.sponsoredCount },
+ { label: 'UGC', value: result.ugcCount },
+ {
+ label: 'Non-page links',
+ value:
+ result.fragmentCount + result.mailtoCount + result.telCount,
+ hint: `${result.fragmentCount} fragments, ${result.mailtoCount} mailto, ${result.telCount} tel`,
+ },
+ ]}
+ />
+ </div>
<DataTable
- columns={['Header', 'Value']}
- rows={Object.entries(result.securityHeaders).map(([name, value]) => [
- mono(name),
- value ? mono(value) : mutedCell('Missing'),
- ])}
+ columns={['Type', 'Anchor', 'Rel', 'URL']}
+ rows={result.links
+ .slice(0, 50)
+ .map((link) => [
+ link.kind,
+ link.isEmpty ? mutedCell('Empty') : link.anchor,
+ link.rel || mutedCell('None'),
+ mono(link.url),
+ ])}
/>
+ {result.duplicateAnchors.length ? (
+ <>
+ <Text as='h3' size='lg' weight='semibold' className='mt-8'>
+ Duplicate anchor candidates
+ </Text>
+ <DataTable
+ columns={['Anchor', 'Distinct URLs']}
+ rows={result.duplicateAnchors.map((item) => [
+ item.anchor,
+ item.urls.map((url) => <div key={url}>{mono(url)}</div>),
+ ])}
+ />
+ </>
+ ) : null}
</ResultPanel>
)
}
-function CanonicalResultView({ result }: { result: CanonicalResult }) {
+function AiCrawlabilityResultView({
+ result,
+}: {
+ result: AiCrawlabilityResult
+}) {
return (
<ResultPanel>
<MetricGrid
items={[
- { label: 'Status', value: result.status },
+ { label: 'Page status', value: result.status },
{
- label: 'Canonical',
- value: result.absoluteCanonical ? 'Present' : 'Missing',
+ label: 'AI crawlers allowed',
+ value: result.crawlerRules.filter((rule) => rule.allowed).length,
+ },
+ {
+ label: 'llms.txt',
+ value: result.llms.status === 200 ? 'Found' : 'Missing',
+ },
+ {
+ label: 'Structured data',
+ value: result.structuredDataCount,
},
- { label: 'Robots', value: result.robots || 'Default' },
- { label: 'Final URL', value: result.finalUrl },
]}
/>
<IssueList issues={result.issues} />
- <div className='mt-6'>
+ <DataTable
+ columns={['Crawler', 'Allowed', 'Matched rule']}
+ rows={result.crawlerRules.map((rule) => [
+ mono(rule.crawler),
+ yesNo(rule.allowed),
+ rule.matchedRule
+ ? mono(`${rule.matchedRule.directive}: ${rule.matchedRule.path}`)
+ : mutedCell('No rule'),
+ ])}
+ />
+ <div className='mt-8'>
<KeyValueList
items={[
- { label: 'Title', value: result.title },
- { label: 'Description', value: result.description },
- { label: 'Canonical tag', value: result.canonical, mono: true },
+ { label: 'Robots.txt', value: result.robotsUrl, mono: true },
{
- label: 'Canonical resolved',
- value: result.absoluteCanonical,
+ label: 'llms.txt',
+ value: `${statusValue(result.llms.status)} ${result.llms.url}`,
mono: true,
},
- { label: 'Open Graph URL', value: result.ogUrl, mono: true },
- { label: 'Requested URL', value: result.requestedUrl, mono: true },
+ {
+ label: 'llms-full.txt',
+ value: `${statusValue(result.llmsFull.status)} ${result.llmsFull.url}`,
+ mono: true,
+ },
+ {
+ label: 'Sitemap',
+ value: `${statusValue(result.sitemap.status)} ${result.sitemap.url}`,
+ mono: true,
+ },
+ { label: 'Canonical', value: result.canonical, mono: true },
+ { label: 'Title', value: result.title },
+ { label: 'Description', value: result.description },
]}
/>
</div>
@@ -1198,41 +2625,85 @@ function CanonicalResultView({ result }: { result: CanonicalResult }) {
)
}
-function PageSizeResultView({ result }: { result: PageSizeResult }) {
+function BulkStatusResultView({ result }: { result: BulkStatusResult }) {
return (
<ResultPanel>
<MetricGrid
items={[
- { label: 'Known size', value: result.totalKnownSize },
- { label: 'HTML size', value: result.htmlSize },
- { label: 'Resources', value: result.resourceCount },
- { label: 'Scan time', value: `${result.scanTime} ms` },
+ { label: 'Checked', value: result.checked },
+ { label: 'OK', value: result.ok },
+ { label: 'Redirects', value: result.redirects },
+ { label: 'Errors', value: result.errors },
]}
/>
<IssueList issues={result.issues} />
<DataTable
- columns={['Category', 'Resources', 'Known size']}
- rows={result.categories.map((category) => [
- category.category,
- mono(category.count),
- mono(category.size),
+ columns={['Status', 'Issue', 'Redirects', 'Content type', 'Final URL']}
+ rows={result.rows.map((row) => [
+ mono(statusValue(row.status)),
+ row.error || row.issue,
+ mono(row.redirectCount),
+ row.contentType || mutedCell('Unknown'),
+ mono(row.finalUrl),
])}
/>
- {result.largestResources.length ? (
- <>
- <Text as='h3' size='lg' weight='semibold' className='mt-8'>
- Largest detected resources
- </Text>
- <DataTable
- columns={['Size', 'Type', 'URL']}
- rows={result.largestResources.map((resource) => [
- mono(resource.size),
- resource.category,
- mono(resource.url),
- ])}
- />
- </>
- ) : null}
+ <div className='mt-8 flex items-center justify-between gap-4'>
+ <Text as='h3' size='lg' weight='semibold'>
+ CSV output
+ </Text>
+ <DownloadCsvButton csv={result.csv} filename='http-statuses.csv' />
+ </div>
+ <CodeBlock code={result.csv} />
+ </ResultPanel>
+ )
+}
+
+function MigrationRedirectResultView({
+ result,
+}: {
+ result: MigrationRedirectResult
+}) {
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Checked', value: result.checked },
+ { label: 'Passed', value: result.passed },
+ { label: 'Mismatches', value: result.mismatches },
+ { label: 'Query drops', value: result.queryDrops },
+ ]}
+ />
+ <IssueList issues={result.issues} />
+ <DataTable
+ columns={[
+ 'Result',
+ 'Status',
+ 'Chain',
+ 'Target match',
+ 'Query kept',
+ 'Old URL',
+ 'Final URL',
+ ]}
+ rows={result.rows.map((row) => [
+ row.error || row.result,
+ mono(statusValue(row.status)),
+ mono(row.redirectCount),
+ yesNo(row.finalMatches),
+ yesNo(row.preservesQuery),
+ mono(row.oldUrl),
+ mono(row.finalUrl),
+ ])}
+ />
+ <div className='mt-8 flex items-center justify-between gap-4'>
+ <Text as='h3' size='lg' weight='semibold'>
+ CSV output
+ </Text>
+ <DownloadCsvButton
+ csv={result.csv}
+ filename='migration-redirects.csv'
+ />
+ </div>
+ <CodeBlock code={result.csv} />
</ResultPanel>
)
}
@@ -1509,11 +2980,646 @@ function WebsiteBandwidthCalculator() {
)
}
+type SerpMode = 'desktop' | 'mobile'
+
+function estimateSnippetPixels(value: string, base = 7.2) {
+ return Array.from(value).reduce((total, character) => {
+ if (character === ' ') return total + base * 0.45
+ if (/[A-Z0-9]/.test(character)) return total + base * 1.08
+ if (/[il.,'|]/.test(character)) return total + base * 0.45
+ if (/[mw@#%&]/i.test(character)) return total + base * 1.35
+ return total + base
+ }, 0)
+}
+
+function buildSerpDisplayUrl(value: string) {
+ try {
+ const url = new URL(
+ (value || 'https://example.com/page').startsWith('http')
+ ? value || 'https://example.com/page'
+ : `https://${value}`,
+ )
+ return `${url.hostname}${url.pathname === '/' ? '' : url.pathname}`
+ } catch {
+ return value || 'example.com/page'
+ }
+}
+
+function SerpSnippetPreview() {
+ const [title, setTitle] = useState('Privacy-first analytics for modern teams')
+ const [description, setDescription] = useState(
+ 'Swetrix gives you cookieless website analytics, performance monitoring, error tracking, and privacy-friendly insights without Google Analytics.',
+ )
+ const [url, setUrl] = useState('https://swetrix.com')
+ const [mode, setMode] = useState<SerpMode>('desktop')
+ const titleLimit = mode === 'desktop' ? 580 : 430
+ const descriptionLimit = mode === 'desktop' ? 920 : 680
+ const titlePixels = estimateSnippetPixels(title, 9.2)
+ const descriptionPixels = estimateSnippetPixels(description, 7.2)
+ const issues: Issue[] = []
+
+ if (!title.trim()) {
+ issues.push({
+ level: 'error',
+ message: 'Title is empty',
+ details: 'Search snippets need a clear title candidate.',
+ })
+ } else if (titlePixels > titleLimit || title.length > 65) {
+ issues.push({
+ level: 'warning',
+ message: 'Title may truncate',
+ details: `${title.length} characters, about ${Math.round(titlePixels)} px.`,
+ })
+ } else {
+ issues.push({
+ level: 'good',
+ message: 'Title length looks usable',
+ details: `${title.length} characters, about ${Math.round(titlePixels)} px.`,
+ })
+ }
+
+ if (!description.trim()) {
+ issues.push({
+ level: 'warning',
+ message: 'Description is empty',
+ details: 'Google may choose page text when no meta description exists.',
+ })
+ } else if (descriptionPixels > descriptionLimit || description.length > 165) {
+ issues.push({
+ level: 'warning',
+ message: 'Description may truncate',
+ details: `${description.length} characters, about ${Math.round(descriptionPixels)} px.`,
+ })
+ } else {
+ issues.push({
+ level: 'good',
+ message: 'Description length looks usable',
+ details: `${description.length} characters, about ${Math.round(descriptionPixels)} px.`,
+ })
+ }
+
+ return (
+ <div className='mt-10 space-y-8'>
+ <div className='rounded-lg bg-white p-6 ring-1 ring-gray-200 dark:bg-slate-950 dark:ring-slate-800'>
+ <div className='grid gap-4 lg:grid-cols-[1fr_1fr]'>
+ <Input
+ label='SEO title'
+ value={title}
+ onChange={(event) => setTitle(event.target.value)}
+ spellCheck={false}
+ />
+ <Input
+ label='URL'
+ value={url}
+ onChange={(event) => setUrl(event.target.value)}
+ spellCheck={false}
+ autoCapitalize='off'
+ />
+ <Textarea
+ label='Meta description'
+ value={description}
+ onChange={(event) => setDescription(event.target.value)}
+ rows={4}
+ classes={{ container: 'lg:col-span-2' }}
+ />
+ </div>
+ <div className='mt-5 inline-flex rounded-lg bg-gray-100 p-1 ring-1 ring-gray-200 dark:bg-slate-900 dark:ring-slate-800'>
+ {(['desktop', 'mobile'] as const).map((item) => (
+ <button
+ key={item}
+ type='button'
+ onClick={() => setMode(item)}
+ className={cn(
+ 'rounded-md px-3 py-1.5 text-sm font-medium transition-colors',
+ mode === item
+ ? 'bg-white text-slate-900 ring-1 ring-gray-200 dark:bg-slate-950 dark:text-white dark:ring-slate-700'
+ : 'text-gray-600 hover:text-slate-900 dark:text-slate-400 dark:hover:text-white',
+ )}
+ >
+ {item === 'desktop' ? 'Desktop' : 'Mobile'}
+ </button>
+ ))}
+ </div>
+ </div>
+
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ {
+ label: 'Title width',
+ value: `${Math.round(titlePixels)} px`,
+ hint: `${Math.round(titleLimit)} px guide`,
+ },
+ {
+ label: 'Title characters',
+ value: title.length,
+ hint: '50 to 60 is often comfortable',
+ },
+ {
+ label: 'Description width',
+ value: `${Math.round(descriptionPixels)} px`,
+ hint: `${Math.round(descriptionLimit)} px guide`,
+ },
+ {
+ label: 'Description characters',
+ value: description.length,
+ hint: '140 to 160 is often comfortable',
+ },
+ ]}
+ />
+ <IssueList issues={issues} />
+ <div
+ className={cn(
+ 'mt-8 rounded-lg bg-white p-5 ring-1 ring-gray-200 dark:bg-slate-950 dark:ring-slate-800',
+ mode === 'mobile' ? 'max-w-[430px]' : 'max-w-[640px]',
+ )}
+ >
+ <div className='truncate text-sm text-gray-600 dark:text-gray-400'>
+ {buildSerpDisplayUrl(url)}
+ </div>
+ <div className='mt-1 line-clamp-2 text-xl leading-snug text-blue-700 dark:text-blue-400'>
+ {title || 'Page title'}
+ </div>
+ <div className='mt-1 line-clamp-2 text-sm leading-relaxed text-gray-600 dark:text-gray-400'>
+ {description ||
+ 'Meta description preview appears here when you enter one.'}
+ </div>
+ </div>
+ </ResultPanel>
+ </div>
+ )
+}
+
+interface GscRow {
+ query: string
+ page: string
+ date: string
+ clicks: number
+ impressions: number
+ ctr: number
+ position: number
+}
+
+interface GscGroup {
+ key: string
+ clicks: number
+ impressions: number
+ ctr: number
+ position: number
+ pages: Set<string>
+}
+
+interface GscAnalysis {
+ rowCount: number
+ totalClicks: number
+ totalImpressions: number
+ averageCtr: number
+ averagePosition: number
+ issues: Issue[]
+ highImpressionLowCtr: GscGroup[]
+ quickWins: GscGroup[]
+ cannibalization: Array<{
+ query: string
+ pages: string[]
+ impressions: number
+ clicks: number
+ }>
+ decliningPages: Array<{
+ page: string
+ previousClicks: number
+ recentClicks: number
+ change: number
+ }>
+}
+
+function parseCsvRows(text: string): string[][] {
+ const rows: string[][] = []
+ let row: string[] = []
+ let current = ''
+ let quoted = false
+
+ for (let index = 0; index < text.length; index += 1) {
+ const character = text[index]
+ const next = text[index + 1]
+
+ if (character === '"' && quoted && next === '"') {
+ current += '"'
+ index += 1
+ continue
+ }
+
+ if (character === '"') {
+ quoted = !quoted
+ continue
+ }
+
+ if (character === ',' && !quoted) {
+ row.push(current)
+ current = ''
+ continue
+ }
+
+ if ((character === '\n' || character === '\r') && !quoted) {
+ if (character === '\r' && next === '\n') index += 1
+ row.push(current)
+ if (row.some((cell) => cell.trim())) rows.push(row)
+ row = []
+ current = ''
+ continue
+ }
+
+ current += character
+ }
+
+ row.push(current)
+ if (row.some((cell) => cell.trim())) rows.push(row)
+ return rows
+}
+
+function parseGscNumber(value: string) {
+ const cleaned = value.replace(/[%,$\s]/g, '').replace(/,/g, '')
+ const parsed = Number(cleaned)
+ return Number.isFinite(parsed) ? parsed : 0
+}
+
+function normalizeGscHeader(value: string) {
+ return value
+ .trim()
+ .toLowerCase()
+ .replace(/[_\s-]+/g, '')
+}
+
+function findColumn(headers: string[], names: string[]) {
+ const normalized = headers.map(normalizeGscHeader)
+ return normalized.findIndex((header) =>
+ names.map(normalizeGscHeader).includes(header),
+ )
+}
+
+function aggregateGscRows(rows: GscRow[], getKey: (row: GscRow) => string) {
+ const groups = new Map<string, GscGroup>()
+
+ for (const row of rows) {
+ const key = getKey(row)
+ if (!key) continue
+
+ const group =
+ groups.get(key) ||
+ ({
+ key,
+ clicks: 0,
+ impressions: 0,
+ ctr: 0,
+ position: 0,
+ pages: new Set<string>(),
+ } satisfies GscGroup)
+
+ group.clicks += row.clicks
+ group.impressions += row.impressions
+ group.position += row.position * row.impressions
+ if (row.page) group.pages.add(row.page)
+ groups.set(key, group)
+ }
+
+ return Array.from(groups.values()).map((group) => ({
+ ...group,
+ ctr: group.impressions ? (group.clicks / group.impressions) * 100 : 0,
+ position: group.impressions ? group.position / group.impressions : 0,
+ }))
+}
+
+function analyzeGscCsv(text: string): GscAnalysis {
+ const table = parseCsvRows(text)
+ if (table.length < 2) throw new Error('The CSV does not contain data rows')
+
+ const headers = table[0]
+ const queryIndex = findColumn(headers, ['query', 'queries'])
+ const pageIndex = findColumn(headers, ['page', 'pages', 'url', 'landingpage'])
+ const dateIndex = findColumn(headers, ['date'])
+ const clicksIndex = findColumn(headers, ['clicks'])
+ const impressionsIndex = findColumn(headers, ['impressions'])
+ const ctrIndex = findColumn(headers, ['ctr'])
+ const positionIndex = findColumn(headers, ['position', 'avgposition'])
+
+ if (clicksIndex === -1 || impressionsIndex === -1 || positionIndex === -1) {
+ throw new Error(
+ 'CSV must include clicks, impressions, and position columns',
+ )
+ }
+
+ const rows = table.slice(1).map((cells) => {
+ const impressions = parseGscNumber(cells[impressionsIndex] || '0')
+ const clicks = parseGscNumber(cells[clicksIndex] || '0')
+ const rawCtr = ctrIndex === -1 ? 0 : parseGscNumber(cells[ctrIndex] || '0')
+
+ return {
+ query: queryIndex === -1 ? '' : (cells[queryIndex] || '').trim(),
+ page: pageIndex === -1 ? '' : (cells[pageIndex] || '').trim(),
+ date: dateIndex === -1 ? '' : (cells[dateIndex] || '').trim(),
+ clicks,
+ impressions,
+ ctr: rawCtr > 1 ? rawCtr : rawCtr * 100,
+ position: parseGscNumber(cells[positionIndex] || '0'),
+ }
+ })
+
+ const usableRows = rows.filter((row) => row.impressions > 0)
+ if (!usableRows.length) throw new Error('No rows with impressions were found')
+
+ const totalClicks = usableRows.reduce((total, row) => total + row.clicks, 0)
+ const totalImpressions = usableRows.reduce(
+ (total, row) => total + row.impressions,
+ 0,
+ )
+ const averagePosition =
+ usableRows.reduce(
+ (total, row) => total + row.position * row.impressions,
+ 0,
+ ) / totalImpressions
+ const primaryGroups = aggregateGscRows(
+ usableRows,
+ queryIndex !== -1 ? (row) => row.query : (row) => row.page,
+ )
+ const threshold = Math.max(100, totalImpressions * 0.002)
+ const highImpressionLowCtr = primaryGroups
+ .filter((group) => group.impressions >= threshold && group.ctr < 2.5)
+ .sort((a, b) => b.impressions - a.impressions)
+ .slice(0, 12)
+ const quickWins = primaryGroups
+ .filter(
+ (group) =>
+ group.impressions >= threshold &&
+ group.position >= 4 &&
+ group.position <= 20,
+ )
+ .sort((a, b) => b.impressions - a.impressions)
+ .slice(0, 12)
+ const cannibalization =
+ queryIndex === -1 || pageIndex === -1
+ ? []
+ : aggregateGscRows(usableRows, (row) => row.query)
+ .filter(
+ (group) => group.pages.size > 1 && group.impressions >= threshold,
+ )
+ .sort((a, b) => b.impressions - a.impressions)
+ .slice(0, 10)
+ .map((group) => ({
+ query: group.key,
+ pages: Array.from(group.pages).slice(0, 5),
+ impressions: group.impressions,
+ clicks: group.clicks,
+ }))
+ const decliningPages =
+ dateIndex === -1 || pageIndex === -1
+ ? []
+ : getDecliningPages(usableRows).slice(0, 10)
+ const issues: Issue[] = []
+
+ if (highImpressionLowCtr.length) {
+ issues.push({
+ level: 'warning',
+ message: `${highImpressionLowCtr.length} low-CTR opportunity row(s)`,
+ details: 'Review titles, descriptions, and search intent alignment.',
+ })
+ }
+
+ if (quickWins.length) {
+ issues.push({
+ level: 'good',
+ message: `${quickWins.length} ranking quick win(s) found`,
+ details:
+ 'These rows already have impressions and positions in striking distance.',
+ })
+ }
+
+ if (cannibalization.length) {
+ issues.push({
+ level: 'info',
+ message: `${cannibalization.length} cannibalization candidate(s)`,
+ details: 'Multiple pages receive impressions for the same query.',
+ })
+ }
+
+ if (decliningPages.length) {
+ issues.push({
+ level: 'warning',
+ message: `${decliningPages.length} declining page(s) found`,
+ details:
+ 'Recent clicks are down compared with earlier dates in the export.',
+ })
+ }
+
+ if (!issues.length) {
+ issues.push({
+ level: 'good',
+ message: 'No obvious priority issues found',
+ details:
+ 'The export did not show clear low-CTR, decline, or cannibalization patterns.',
+ })
+ }
+
+ return {
+ rowCount: usableRows.length,
+ totalClicks,
+ totalImpressions,
+ averageCtr: totalImpressions ? (totalClicks / totalImpressions) * 100 : 0,
+ averagePosition,
+ issues,
+ highImpressionLowCtr,
+ quickWins,
+ cannibalization,
+ decliningPages,
+ }
+}
+
+function getDecliningPages(rows: GscRow[]) {
+ const dates = Array.from(
+ new Set(rows.map((row) => row.date).filter(Boolean)),
+ ).sort()
+ if (dates.length < 2) return []
+
+ const midpoint = Math.floor(dates.length / 2)
+ const earlier = new Set(dates.slice(0, midpoint))
+ const later = new Set(dates.slice(midpoint))
+ const pages = new Map<
+ string,
+ { previousClicks: number; recentClicks: number }
+ >()
+
+ for (const row of rows) {
+ if (!row.page) continue
+
+ const current = pages.get(row.page) || {
+ previousClicks: 0,
+ recentClicks: 0,
+ }
+ if (earlier.has(row.date)) current.previousClicks += row.clicks
+ if (later.has(row.date)) current.recentClicks += row.clicks
+ pages.set(row.page, current)
+ }
+
+ return Array.from(pages.entries())
+ .map(([page, value]) => ({
+ page,
+ previousClicks: value.previousClicks,
+ recentClicks: value.recentClicks,
+ change:
+ value.previousClicks > 0
+ ? ((value.recentClicks - value.previousClicks) /
+ value.previousClicks) *
+ 100
+ : 0,
+ }))
+ .filter((row) => row.previousClicks >= 5 && row.change <= -20)
+ .sort((a, b) => a.change - b.change)
+}
+
+function GscExportAnalyzer() {
+ const [analysis, setAnalysis] = useState<GscAnalysis | null>(null)
+ const [error, setError] = useState<string | null>(null)
+ const [fileName, setFileName] = useState('')
+
+ const handleFile = async (file: File | undefined) => {
+ setError(null)
+ setAnalysis(null)
+
+ if (!file) return
+
+ try {
+ const text = await file.text()
+ setFileName(file.name)
+ setAnalysis(analyzeGscCsv(text))
+ } catch (err) {
+ setError(getClientErrorMessage(err))
+ }
+ }
+
+ return (
+ <div className='mt-10 space-y-8'>
+ <div className='rounded-lg bg-white p-6 ring-1 ring-gray-200 dark:bg-slate-950 dark:ring-slate-800'>
+ <label className='block'>
+ <Text as='span' size='sm' weight='medium'>
+ Google Search Console CSV
+ </Text>
+ <input
+ type='file'
+ accept='.csv,text/csv'
+ onChange={(event) => handleFile(event.target.files?.[0])}
+ className='mt-2 block w-full rounded-md bg-white px-3 py-2 text-sm text-gray-900 ring-1 ring-gray-300 transition-shadow duration-150 ease-out ring-inset file:mr-3 file:rounded-md file:border-0 file:bg-gray-100 file:px-3 file:py-1.5 file:text-sm file:font-medium file:text-slate-900 hover:ring-gray-400 focus:ring-2 focus:ring-slate-900 focus:outline-hidden dark:bg-slate-950 dark:text-gray-50 dark:ring-slate-700/80 dark:file:bg-slate-800 dark:file:text-slate-100 dark:hover:ring-slate-600 dark:focus:ring-slate-300'
+ />
+ </label>
+ {fileName ? (
+ <Text as='p' size='sm' colour='muted' className='mt-3'>
+ Loaded {fileName}
+ </Text>
+ ) : null}
+ </div>
+
+ {error ? (
+ <div className='rounded-lg bg-red-50 p-4 text-sm text-red-700 ring-1 ring-red-200 dark:bg-red-500/10 dark:text-red-300 dark:ring-red-500/25'>
+ {error}
+ </div>
+ ) : null}
+
+ {analysis ? <GscAnalysisResult analysis={analysis} /> : null}
+ </div>
+ )
+}
+
+function getClientErrorMessage(error: unknown) {
+ if (error instanceof Error) return error.message
+ return 'Unexpected error'
+}
+
+function GscAnalysisResult({ analysis }: { analysis: GscAnalysis }) {
+ return (
+ <ResultPanel>
+ <MetricGrid
+ items={[
+ { label: 'Rows', value: analysis.rowCount.toLocaleString() },
+ { label: 'Clicks', value: analysis.totalClicks.toLocaleString() },
+ {
+ label: 'Impressions',
+ value: analysis.totalImpressions.toLocaleString(),
+ },
+ {
+ label: 'Average CTR',
+ value: `${analysis.averageCtr.toFixed(2)}%`,
+ hint: `Average position ${analysis.averagePosition.toFixed(1)}`,
+ },
+ ]}
+ />
+ <IssueList issues={analysis.issues} />
+ <GscGroupTable
+ title='High-impression low-CTR opportunities'
+ rows={analysis.highImpressionLowCtr}
+ />
+ <GscGroupTable title='Quick-win rankings' rows={analysis.quickWins} />
+ {analysis.cannibalization.length ? (
+ <>
+ <Text as='h3' size='lg' weight='semibold' className='mt-8'>
+ Cannibalization candidates
+ </Text>
+ <DataTable
+ columns={['Query', 'Impressions', 'Clicks', 'Pages']}
+ rows={analysis.cannibalization.map((item) => [
+ item.query,
+ mono(item.impressions.toLocaleString()),
+ mono(item.clicks.toLocaleString()),
+ item.pages.map((page) => <div key={page}>{mono(page)}</div>),
+ ])}
+ />
+ </>
+ ) : null}
+ {analysis.decliningPages.length ? (
+ <>
+ <Text as='h3' size='lg' weight='semibold' className='mt-8'>
+ Declining pages
+ </Text>
+ <DataTable
+ columns={['Page', 'Previous clicks', 'Recent clicks', 'Change']}
+ rows={analysis.decliningPages.map((item) => [
+ mono(item.page),
+ mono(item.previousClicks.toLocaleString()),
+ mono(item.recentClicks.toLocaleString()),
+ mono(`${item.change.toFixed(1)}%`),
+ ])}
+ />
+ </>
+ ) : null}
+ </ResultPanel>
+ )
+}
+
+function GscGroupTable({ title, rows }: { title: string; rows: GscGroup[] }) {
+ if (!rows.length) return null
+
+ return (
+ <>
+ <Text as='h3' size='lg' weight='semibold' className='mt-8'>
+ {title}
+ </Text>
+ <DataTable
+ columns={['Query or page', 'Impressions', 'Clicks', 'CTR', 'Position']}
+ rows={rows.map((row) => [
+ row.key,
+ mono(row.impressions.toLocaleString()),
+ mono(row.clicks.toLocaleString()),
+ mono(`${row.ctr.toFixed(2)}%`),
+ mono(row.position.toFixed(1)),
+ ])}
+ />
+ </>
+ )
+}
+
function ToolInteractive({ slug }: { slug: TechnicalToolSlug }) {
if (slug === 'uptime-sla-calculator') return <UptimeSlaCalculator />
if (slug === 'website-bandwidth-calculator') {
return <WebsiteBandwidthCalculator />
}
+ if (slug === 'serp-snippet-preview') return <SerpSnippetPreview />
+ if (slug === 'gsc-export-analyzer') return <GscExportAnalyzer />
return <ServerTool slug={slug} config={TOOL_CONTENT[slug]} />
}
diff --git a/web/app/lib/freeTools.server.ts b/web/app/lib/freeTools.server.ts
index 9716c9daf..9dd74c929 100644
--- a/web/app/lib/freeTools.server.ts
+++ b/web/app/lib/freeTools.server.ts
@@ -1,3 +1,5 @@
+import { runSeoToolAction, type SeoToolSlug } from './seoTools.server'
+
export type ToolActionData = {
error: string | null
result: unknown | null
@@ -14,6 +16,9 @@ type ToolSlug =
| 'page-size-checker'
| 'uptime-sla-calculator'
| 'website-bandwidth-calculator'
+ | 'serp-snippet-preview'
+ | 'gsc-export-analyzer'
+ | SeoToolSlug
type IssueLevel = 'good' | 'warning' | 'error' | 'info'
@@ -1050,6 +1055,20 @@ export async function runTechnicalToolAction(
if (slug === 'csp-checker') return checkCsp(formData)
if (slug === 'canonical-url-checker') return checkCanonicalUrl(formData)
if (slug === 'page-size-checker') return checkPageSize(formData)
+ if (
+ slug === 'indexability-checker' ||
+ slug === 'robots-txt-tester' ||
+ slug === 'broken-link-checker' ||
+ slug === 'hreflang-checker' ||
+ slug === 'on-page-seo-checker' ||
+ slug === 'image-seo-checker' ||
+ slug === 'internal-link-analyzer' ||
+ slug === 'ai-search-llm-crawlability-checker' ||
+ slug === 'http-status-bulk-checker' ||
+ slug === 'seo-migration-redirect-validator'
+ ) {
+ return runSeoToolAction(slug, formData)
+ }
return { error: 'This tool does not require a server action', result: null }
}
diff --git a/web/app/lib/seoTools.server.ts b/web/app/lib/seoTools.server.ts
new file mode 100644
index 000000000..fcb55215a
--- /dev/null
+++ b/web/app/lib/seoTools.server.ts
@@ -0,0 +1,2351 @@
+import type { ToolActionData } from './freeTools.server'
+
+export type SeoToolSlug =
+ | 'indexability-checker'
+ | 'robots-txt-tester'
+ | 'broken-link-checker'
+ | 'hreflang-checker'
+ | 'on-page-seo-checker'
+ | 'image-seo-checker'
+ | 'internal-link-analyzer'
+ | 'ai-search-llm-crawlability-checker'
+ | 'http-status-bulk-checker'
+ | 'seo-migration-redirect-validator'
+
+type IssueLevel = 'good' | 'warning' | 'error' | 'info'
+
+interface Issue {
+ level: IssueLevel
+ message: string
+ details?: string
+}
+
+interface RobotsRule {
+ directive: 'allow' | 'disallow'
+ path: string
+}
+
+interface RobotsGroup {
+ agents: string[]
+ rules: RobotsRule[]
+}
+
+interface RobotsData {
+ groups: RobotsGroup[]
+ sitemaps: string[]
+}
+
+interface AnchorEntry {
+ href: string | null
+ url: string | null
+ anchor: string
+ rel: string
+ kind: 'internal' | 'external' | 'fragment' | 'mailto' | 'tel' | 'invalid'
+ isEmpty: boolean
+}
+
+interface StatusTrace {
+ url: string
+ status: number | null
+ statusText: string
+ finalUrl: string
+ redirectCount: number
+ chain: Array<{
+ url: string
+ status: number | null
+ location: string | null
+ }>
+ contentType: string | null
+ error: string | null
+}
+
+const USER_AGENT = 'Swetrix-Free-SEO-Tools/1.0'
+const HTML_LIMIT = 1024 * 1024
+const SMALL_TEXT_LIMIT = 250 * 1024
+const STATUS_LIMIT = 50
+const LINK_CHECK_LIMIT = 60
+const IMAGE_HEAD_LIMIT = 30
+
+const AI_CRAWLERS = [
+ 'GPTBot',
+ 'ChatGPT-User',
+ 'ClaudeBot',
+ 'PerplexityBot',
+ 'Google-Extended',
+ 'CCBot',
+ 'Applebot',
+ 'Meta-ExternalAgent',
+]
+
+function getFormText(formData: FormData, name: string): string {
+ return String(formData.get(name) || '').trim()
+}
+
+function getFormValue(formData: FormData): string {
+ return getFormText(formData, 'value')
+}
+
+function getErrorMessage(error: unknown): string {
+ if (error instanceof Error) return error.message
+ return 'Unexpected error'
+}
+
+function normalizeUrl(value: string): string {
+ const trimmed = value.trim()
+ if (!trimmed) throw new Error('Please enter a URL')
+
+ const url = new URL(
+ /^[a-z][a-z\d+.-]*:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`,
+ )
+
+ if (url.protocol !== 'http:' && url.protocol !== 'https:') {
+ throw new Error('Only HTTP and HTTPS URLs are supported')
+ }
+
+ return url.toString()
+}
+
+function normalizePath(value: string): string {
+ const trimmed = value.trim() || '/'
+ if (/^https?:\/\//i.test(trimmed)) {
+ const url = new URL(trimmed)
+ return `${url.pathname}${url.search}`
+ }
+ return trimmed.startsWith('/') ? trimmed : `/${trimmed}`
+}
+
+function getOrigin(url: string): string {
+ return new URL(url).origin
+}
+
+function getRobotsUrl(value: string): string {
+ const normalized = normalizeUrl(value)
+ const url = new URL(normalized)
+ if (url.pathname.endsWith('/robots.txt')) {
+ url.search = ''
+ url.hash = ''
+ return url.toString()
+ }
+ return `${url.origin}/robots.txt`
+}
+
+async function fetchWithTimeout(
+ url: string,
+ init: RequestInit = {},
+ timeout = 10000,
+): Promise<Response> {
+ const controller = new AbortController()
+ const timeoutId = setTimeout(() => controller.abort(), timeout)
+ const headers = new Headers(init.headers)
+
+ if (!headers.has('user-agent')) headers.set('User-Agent', USER_AGENT)
+ if (!headers.has('accept')) {
+ headers.set(
+ 'Accept',
+ 'text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8',
+ )
+ }
+
+ try {
+ return await fetch(url, {
+ ...init,
+ headers,
+ signal: controller.signal,
+ })
+ } finally {
+ clearTimeout(timeoutId)
+ }
+}
+
+async function readTextWithLimit(
+ response: Response,
+ maxBytes = HTML_LIMIT,
+): Promise<string> {
+ if (!response.body) return response.text()
+
+ const reader = response.body.getReader()
+ const decoder = new TextDecoder()
+ let total = 0
+ let output = ''
+
+ while (true) {
+ const { done, value } = await reader.read()
+ if (done) break
+ total += value.byteLength
+ if (total > maxBytes) {
+ await reader.cancel().catch(() => {})
+ break
+ }
+ output += decoder.decode(value, { stream: true })
+ }
+
+ output += decoder.decode()
+ return output
+}
+
+function escapeRegex(value: string): string {
+ return value.replace(/[.+?^${}()|[\]\\]/g, '\\$&')
+}
+
+function getAttributeValue(tag: string, attribute: string): string | null {
+ const match = tag.match(
+ new RegExp(`\\s${attribute}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`, 'i'),
+ )
+ if (!match) return null
+ return match[2] ?? match[3] ?? match[4] ?? ''
+}
+
+function getAttribute(tag: string, attribute: string): string | null {
+ const value = getAttributeValue(tag, attribute)
+ return value === null ? null : value.trim() || null
+}
+
+function decodeHtml(value: string): string {
+ return value
+ .replace(/&nbsp;/g, ' ')
+ .replace(/&amp;/g, '&')
+ .replace(/&quot;/g, '"')
+ .replace(/&#39;/g, "'")
+ .replace(/&lt;/g, '<')
+ .replace(/&gt;/g, '>')
+ .replace(/\s+/g, ' ')
+ .trim()
+}
+
+function stripTags(html: string): string {
+ return decodeHtml(
+ html
+ .replace(/<script[\s\S]*?<\/script>/gi, ' ')
+ .replace(/<style[\s\S]*?<\/style>/gi, ' ')
+ .replace(/<[^>]+>/g, ' '),
+ )
+}
+
+function extractTitle(html: string): string | null {
+ const match = html.match(/<title[^>]*>([\s\S]*?)<\/title>/i)
+ return match?.[1] ? decodeHtml(match[1]) : null
+}
+
+function findMetaContent(html: string, name: string): string | null {
+ const tags = html.match(/<meta\b[^>]*>/gi) || []
+ const target = name.toLowerCase()
+
+ for (const tag of tags) {
+ const metaName =
+ getAttribute(tag, 'name')?.toLowerCase() ||
+ getAttribute(tag, 'property')?.toLowerCase()
+ if (metaName === target)
+ return decodeHtml(getAttribute(tag, 'content') || '')
+ }
+
+ return null
+}
+
+function findAllMetaContent(html: string, names: string[]): string[] {
+ const wanted = new Set(names.map((name) => name.toLowerCase()))
+ const tags = html.match(/<meta\b[^>]*>/gi) || []
+ const values: string[] = []
+
+ for (const tag of tags) {
+ const metaName =
+ getAttribute(tag, 'name')?.toLowerCase() ||
+ getAttribute(tag, 'property')?.toLowerCase()
+ if (metaName && wanted.has(metaName)) {
+ const value = getAttribute(tag, 'content')
+ if (value) values.push(decodeHtml(value))
+ }
+ }
+
+ return values
+}
+
+function findCanonical(
+ html: string,
+ baseUrl: string,
+): {
+ raw: string | null
+ absolute: string | null
+} {
+ const canonicalTag = (html.match(/<link\b[^>]*>/gi) || []).find((tag) =>
+ /\brel\s*=\s*["'][^"']*\bcanonical\b[^"']*["']/i.test(tag),
+ )
+ const raw = canonicalTag ? getAttribute(canonicalTag, 'href') : null
+
+ if (!raw) return { raw: null, absolute: null }
+
+ try {
+ return { raw, absolute: new URL(raw, baseUrl).toString() }
+ } catch {
+ return { raw, absolute: null }
+ }
+}
+
+function hasNoDirective(value: string | null, directive: string): boolean {
+ return Boolean(
+ value
+ ?.toLowerCase()
+ .split(',')
+ .map((part) => part.trim())
+ .some((part) => part === directive),
+ )
+}
+
+function parseRobotsTxt(text: string): RobotsData {
+ const groups: RobotsGroup[] = []
+ const sitemaps: string[] = []
+ let agents: string[] = []
+ let rules: RobotsRule[] = []
+
+ const pushGroup = () => {
+ if (agents.length) {
+ groups.push({ agents, rules })
+ }
+ agents = []
+ rules = []
+ }
+
+ for (const rawLine of text.split(/\r?\n/)) {
+ const line = rawLine.replace(/#.*/, '').trim()
+ if (!line) continue
+
+ const separator = line.indexOf(':')
+ if (separator === -1) continue
+
+ const field = line.slice(0, separator).trim().toLowerCase()
+ const value = line.slice(separator + 1).trim()
+
+ if (field === 'sitemap' && value) {
+ sitemaps.push(value)
+ continue
+ }
+
+ if (field === 'user-agent') {
+ if (rules.length) pushGroup()
+ if (value) agents.push(value.toLowerCase())
+ continue
+ }
+
+ if ((field === 'allow' || field === 'disallow') && agents.length) {
+ rules.push({ directive: field, path: value })
+ }
+ }
+
+ pushGroup()
+ return { groups, sitemaps: Array.from(new Set(sitemaps)) }
+}
+
+function userAgentTokenMatches(token: string, userAgent: string): boolean {
+ if (token === '*') return true
+ return userAgent.toLowerCase().includes(token.toLowerCase())
+}
+
+function robotsRuleMatches(pattern: string, path: string): boolean {
+ if (!pattern) return false
+
+ const endsWithDollar = pattern.endsWith('$')
+ const cleanPattern = endsWithDollar ? pattern.slice(0, -1) : pattern
+ const source = cleanPattern.split('*').map(escapeRegex).join('.*')
+ const regex = new RegExp(`^${source}${endsWithDollar ? '$' : ''}`)
+
+ return regex.test(path)
+}
+
+function testRobotsRule(
+ robots: RobotsData | null,
+ userAgent: string,
+ path: string,
+) {
+ if (!robots) {
+ return {
+ allowed: true,
+ matchedRule: null,
+ groupAgents: [],
+ }
+ }
+
+ const matchingGroups = robots.groups
+ .map((group) => {
+ const matchedLength = Math.max(
+ ...group.agents
+ .filter((agent) => userAgentTokenMatches(agent, userAgent))
+ .map((agent) => (agent === '*' ? 0 : agent.length)),
+ -1,
+ )
+ return { group, matchedLength }
+ })
+ .filter((entry) => entry.matchedLength >= 0)
+
+ if (!matchingGroups.length) {
+ return {
+ allowed: true,
+ matchedRule: null,
+ groupAgents: [],
+ }
+ }
+
+ const bestLength = Math.max(
+ ...matchingGroups.map((entry) => entry.matchedLength),
+ )
+ const rules = matchingGroups
+ .filter((entry) => entry.matchedLength === bestLength)
+ .flatMap((entry) => entry.group.rules)
+
+ const matchedRules = rules
+ .filter((rule) => robotsRuleMatches(rule.path, path))
+ .sort((a, b) => {
+ if (b.path.length !== a.path.length) return b.path.length - a.path.length
+ if (a.directive === b.directive) return 0
+ return a.directive === 'allow' ? -1 : 1
+ })
+
+ const matchedRule = matchedRules[0] || null
+
+ return {
+ allowed: matchedRule ? matchedRule.directive === 'allow' : true,
+ matchedRule,
+ groupAgents: Array.from(
+ new Set(
+ matchingGroups
+ .filter((entry) => entry.matchedLength === bestLength)
+ .flatMap((entry) => entry.group.agents),
+ ),
+ ),
+ }
+}
+
+async function fetchRobotsForUrl(url: string) {
+ const robotsUrl = `${getOrigin(url)}/robots.txt`
+
+ try {
+ const response = await fetchWithTimeout(
+ robotsUrl,
+ { redirect: 'follow' },
+ 8000,
+ )
+ const text = await readTextWithLimit(response, SMALL_TEXT_LIMIT)
+
+ if (!response.ok) {
+ return {
+ robotsUrl,
+ status: response.status,
+ data: null,
+ error: `robots.txt returned ${response.status}`,
+ }
+ }
+
+ return {
+ robotsUrl,
+ status: response.status,
+ data: parseRobotsTxt(text),
+ error: null,
+ }
+ } catch (error) {
+ return {
+ robotsUrl,
+ status: null,
+ data: null,
+ error: getErrorMessage(error),
+ }
+ }
+}
+
+function extractAnchors(html: string, baseUrl: string): AnchorEntry[] {
+ const base = new URL(baseUrl)
+ const anchors: AnchorEntry[] = []
+ const regex = /<a\b([^>]*)>([\s\S]*?)<\/a>/gi
+ let match: RegExpExecArray | null
+
+ while ((match = regex.exec(html))) {
+ const tag = `<a ${match[1]}>`
+ const href = getAttribute(tag, 'href')
+ const rel = getAttribute(tag, 'rel') || ''
+ const anchor = stripTags(match[2])
+ const isEmpty = anchor.length === 0
+
+ if (!href) {
+ anchors.push({
+ href: null,
+ url: null,
+ anchor,
+ rel,
+ kind: 'invalid',
+ isEmpty,
+ })
+ continue
+ }
+
+ const lowerHref = href.toLowerCase()
+
+ if (href.startsWith('#')) {
+ anchors.push({
+ href,
+ url: null,
+ anchor,
+ rel,
+ kind: 'fragment',
+ isEmpty,
+ })
+ continue
+ }
+
+ if (lowerHref.startsWith('mailto:') || lowerHref.startsWith('tel:')) {
+ anchors.push({
+ href,
+ url: null,
+ anchor,
+ rel,
+ kind: lowerHref.startsWith('mailto:') ? 'mailto' : 'tel',
+ isEmpty,
+ })
+ continue
+ }
+
+ try {
+ const url = new URL(href, baseUrl)
+ const isHttp = url.protocol === 'http:' || url.protocol === 'https:'
+
+ anchors.push({
+ href,
+ url: isHttp ? url.toString() : null,
+ anchor,
+ rel,
+ kind: isHttp
+ ? url.hostname === base.hostname
+ ? 'internal'
+ : 'external'
+ : 'invalid',
+ isEmpty,
+ })
+ } catch {
+ anchors.push({
+ href,
+ url: null,
+ anchor,
+ rel,
+ kind: 'invalid',
+ isEmpty,
+ })
+ }
+ }
+
+ return anchors
+}
+
+function extractImageTags(html: string, baseUrl: string) {
+ const images: Array<{
+ src: string | null
+ alt: string | null
+ hasAlt: boolean
+ width: string | null
+ height: string | null
+ loading: string | null
+ format: string
+ }> = []
+ const tags = html.match(/<img\b[^>]*>/gi) || []
+
+ for (const tag of tags) {
+ const rawSrc = getAttribute(tag, 'src') || getFirstSrcsetUrl(tag)
+ const rawAlt = getAttributeValue(tag, 'alt')
+ let src: string | null = null
+
+ if (rawSrc && !rawSrc.startsWith('data:')) {
+ try {
+ src = new URL(rawSrc, baseUrl).toString()
+ } catch {
+ src = null
+ }
+ }
+
+ images.push({
+ src,
+ alt: rawAlt === null ? null : decodeHtml(rawAlt),
+ hasAlt: rawAlt !== null,
+ width: getAttribute(tag, 'width'),
+ height: getAttribute(tag, 'height'),
+ loading: getAttribute(tag, 'loading'),
+ format: getImageFormat(src || rawSrc || ''),
+ })
+ }
+
+ return images
+}
+
+function getFirstSrcsetUrl(tag: string): string | null {
+ const srcset = getAttribute(tag, 'srcset')
+ if (!srcset) return null
+
+ return (
+ srcset
+ .split(',')
+ .map((candidate) => candidate.trim().split(/\s+/)[0])
+ .find(Boolean) || null
+ )
+}
+
+function getImageFormat(url: string): string {
+ const path = (() => {
+ try {
+ return new URL(url).pathname.toLowerCase()
+ } catch {
+ return url.toLowerCase()
+ }
+ })()
+ const match = path.match(/\.([a-z0-9]+)$/)
+ return match?.[1] || 'unknown'
+}
+
+async function traceStatus(
+ inputUrl: string,
+ maxRedirects = 6,
+): Promise<StatusTrace> {
+ let currentUrl = inputUrl
+ const chain: StatusTrace['chain'] = []
+ let contentType: string | null = null
+
+ try {
+ for (let index = 0; index <= maxRedirects; index += 1) {
+ let response = await fetchWithTimeout(
+ currentUrl,
+ { method: 'HEAD', redirect: 'manual' },
+ 8000,
+ )
+
+ if (response.status === 405 || response.status === 403) {
+ await response.body?.cancel().catch(() => {})
+ response = await fetchWithTimeout(
+ currentUrl,
+ { method: 'GET', redirect: 'manual' },
+ 8000,
+ )
+ }
+
+ const location = response.headers.get('location')
+ contentType = response.headers.get('content-type')
+ const nextUrl =
+ location && response.status >= 300 && response.status < 400
+ ? new URL(location, currentUrl).toString()
+ : null
+
+ chain.push({
+ url: currentUrl,
+ status: response.status,
+ location: nextUrl,
+ })
+
+ await response.body?.cancel().catch(() => {})
+
+ if (!nextUrl) {
+ return {
+ url: inputUrl,
+ status: response.status,
+ statusText: response.statusText,
+ finalUrl: currentUrl,
+ redirectCount: Math.max(chain.length - 1, 0),
+ chain,
+ contentType,
+ error: null,
+ }
+ }
+
+ currentUrl = nextUrl
+ }
+
+ return {
+ url: inputUrl,
+ status: chain[chain.length - 1]?.status || null,
+ statusText: 'Redirect limit reached',
+ finalUrl: currentUrl,
+ redirectCount: Math.max(chain.length - 1, 0),
+ chain,
+ contentType,
+ error: 'Redirect limit reached',
+ }
+ } catch (error) {
+ return {
+ url: inputUrl,
+ status: null,
+ statusText: 'Failed',
+ finalUrl: currentUrl,
+ redirectCount: Math.max(chain.length - 1, 0),
+ chain,
+ contentType,
+ error: getErrorMessage(error),
+ }
+ }
+}
+
+async function mapLimited<T, R>(
+ items: T[],
+ limit: number,
+ run: (item: T, index: number) => Promise<R>,
+): Promise<R[]> {
+ const results: R[] = []
+ let cursor = 0
+
+ async function worker() {
+ while (cursor < items.length) {
+ const index = cursor
+ cursor += 1
+ results[index] = await run(items[index], index)
+ }
+ }
+
+ await Promise.all(
+ Array.from({ length: Math.min(limit, items.length) }, () => worker()),
+ )
+
+ return results
+}
+
+function getStatusIssue(status: number | null, error: string | null): Issue {
+ if (error || status === null) {
+ return {
+ level: 'error',
+ message: 'Request failed',
+ details: error || 'The URL could not be checked.',
+ }
+ }
+
+ if (status >= 500) {
+ return {
+ level: 'error',
+ message: `Server error ${status}`,
+ details: 'Search engines and users may not be able to access this URL.',
+ }
+ }
+
+ if (status === 404 || status === 410) {
+ return {
+ level: 'error',
+ message: `Not found ${status}`,
+ details: 'The URL is gone or missing.',
+ }
+ }
+
+ if (status >= 400) {
+ return {
+ level: 'warning',
+ message: `HTTP ${status}`,
+ details: 'The response needs review.',
+ }
+ }
+
+ if (status >= 300) {
+ return {
+ level: 'info',
+ message: `Redirect ${status}`,
+ details: 'The URL redirects before reaching a final destination.',
+ }
+ }
+
+ return {
+ level: 'good',
+ message: `HTTP ${status}`,
+ details: 'The URL is reachable.',
+ }
+}
+
+function classifyLinkIssue(trace: StatusTrace): string {
+ if (trace.error || trace.status === null) return 'Failed'
+ if (trace.status >= 500) return 'Server error'
+ if (trace.status === 404 || trace.status === 410) return 'Broken'
+ if (trace.status >= 400) return 'HTTP error'
+ if (trace.redirectCount > 0) return 'Redirect'
+ return 'OK'
+}
+
+async function fetchPageHtml(input: string) {
+ const url = normalizeUrl(input)
+ const response = await fetchWithTimeout(url, { redirect: 'follow' }, 12000)
+ const html = await readTextWithLimit(response, HTML_LIMIT)
+ return { url, response, html }
+}
+
+async function checkIndexability(formData: FormData): Promise<ToolActionData> {
+ let page
+
+ try {
+ page = await fetchPageHtml(getFormValue(formData))
+ } catch (error) {
+ return {
+ error: `Indexability check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+
+ try {
+ const { url, response, html } = page
+ const finalUrl = response.url
+ const title = extractTitle(html)
+ const description = findMetaContent(html, 'description')
+ const metaRobots = findAllMetaContent(html, ['robots', 'googlebot']).join(
+ ', ',
+ )
+ const xRobotsTag = response.headers.get('x-robots-tag')
+ const canonical = findCanonical(html, finalUrl)
+ const robots = await fetchRobotsForUrl(finalUrl)
+ const path = `${new URL(finalUrl).pathname}${new URL(finalUrl).search}`
+ const robotsTest = testRobotsRule(robots.data, 'Googlebot', path)
+ const sitemapHint = robots.data?.sitemaps[0] || null
+ const contentType = response.headers.get('content-type')
+ const issues: Issue[] = []
+
+ if (response.status < 200 || response.status >= 300) {
+ issues.push({
+ level: 'error',
+ message: `Page returns HTTP ${response.status}`,
+ details: 'Indexable pages should usually return a 200 status.',
+ })
+ }
+
+ if (!contentType?.toLowerCase().includes('html')) {
+ issues.push({
+ level: 'warning',
+ message: 'Response is not clearly HTML',
+ details: `Content-Type is ${contentType || 'missing'}.`,
+ })
+ }
+
+ if (!robotsTest.allowed) {
+ issues.push({
+ level: 'error',
+ message: 'Blocked by robots.txt for Googlebot',
+ details: `Matched ${robotsTest.matchedRule?.directive}: ${robotsTest.matchedRule?.path}`,
+ })
+ }
+
+ if (robots.error) {
+ issues.push({
+ level: 'info',
+ message: 'robots.txt could not be read',
+ details: robots.error,
+ })
+ }
+
+ if (
+ hasNoDirective(metaRobots, 'noindex') ||
+ hasNoDirective(xRobotsTag, 'noindex')
+ ) {
+ issues.push({
+ level: 'error',
+ message: 'Page is marked noindex',
+ details:
+ 'A noindex directive tells search engines not to index the page.',
+ })
+ }
+
+ if (
+ hasNoDirective(metaRobots, 'nofollow') ||
+ hasNoDirective(xRobotsTag, 'nofollow')
+ ) {
+ issues.push({
+ level: 'warning',
+ message: 'Page uses nofollow',
+ details:
+ 'Nofollow does not always block indexing, but it changes link discovery and ranking signals.',
+ })
+ }
+
+ if (!canonical.absolute) {
+ issues.push({
+ level: 'warning',
+ message: 'Canonical URL is missing',
+ details:
+ 'Google can index without it, but canonical clarity reduces duplicate URL risk.',
+ })
+ } else if (canonical.absolute !== finalUrl) {
+ issues.push({
+ level: 'info',
+ message: 'Canonical points to a different URL',
+ details: canonical.absolute,
+ })
+ }
+
+ if (!title) {
+ issues.push({
+ level: 'warning',
+ message: 'Page title is missing',
+ details: 'Search snippets usually need a clear title.',
+ })
+ }
+
+ if (!description) {
+ issues.push({
+ level: 'info',
+ message: 'Meta description is missing',
+ details: 'Descriptions can improve search result click-through rate.',
+ })
+ }
+
+ if (issues.every((issue) => issue.level !== 'error')) {
+ issues.unshift({
+ level: 'good',
+ message: 'No hard indexing block was detected',
+ details:
+ 'The page is reachable, not blocked by robots.txt, and not marked noindex.',
+ })
+ }
+
+ const hasHardBlock = issues.some((issue) => issue.level === 'error')
+
+ return {
+ error: null,
+ result: {
+ requestedUrl: url,
+ finalUrl,
+ status: response.status,
+ indexability: hasHardBlock
+ ? 'Blocked or not indexable'
+ : 'Likely indexable',
+ robotsTxt: {
+ url: robots.robotsUrl,
+ status: robots.status,
+ allowed: robotsTest.allowed,
+ matchedRule: robotsTest.matchedRule,
+ },
+ metaRobots: metaRobots || null,
+ xRobotsTag,
+ canonical: canonical.raw,
+ absoluteCanonical: canonical.absolute,
+ sitemapHint,
+ title,
+ description,
+ issues,
+ },
+ }
+ } catch (error) {
+ return {
+ error: `Indexability check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+}
+
+async function testRobotsTxt(formData: FormData): Promise<ToolActionData> {
+ let robotsUrl: string
+ const value = getFormText(formData, 'robotsUrl') || getFormValue(formData)
+ const userAgent = getFormText(formData, 'userAgent') || 'Googlebot'
+ const path = normalizePath(getFormText(formData, 'path') || '/')
+
+ try {
+ robotsUrl = getRobotsUrl(value)
+ } catch (error) {
+ return { error: getErrorMessage(error), result: null }
+ }
+
+ try {
+ const response = await fetchWithTimeout(
+ robotsUrl,
+ { redirect: 'follow' },
+ 10000,
+ )
+ const text = await readTextWithLimit(response, SMALL_TEXT_LIMIT)
+
+ if (!response.ok) {
+ return {
+ error: `robots.txt returned HTTP ${response.status}`,
+ result: null,
+ }
+ }
+
+ const robots = parseRobotsTxt(text)
+ const tests = [
+ userAgent,
+ 'Googlebot',
+ 'Bingbot',
+ 'GPTBot',
+ 'ChatGPT-User',
+ 'ClaudeBot',
+ 'PerplexityBot',
+ ]
+ .filter((agent, index, list) => list.indexOf(agent) === index)
+ .map((agent) => ({
+ userAgent: agent,
+ ...testRobotsRule(robots, agent, path),
+ }))
+
+ const selected = tests[0]
+ const issues: Issue[] = [
+ selected.allowed
+ ? {
+ level: 'good',
+ message: `${userAgent} can crawl this path`,
+ details: selected.matchedRule
+ ? `Matched ${selected.matchedRule.directive}: ${selected.matchedRule.path}`
+ : 'No blocking rule matched.',
+ }
+ : {
+ level: 'error',
+ message: `${userAgent} is blocked from this path`,
+ details: `Matched disallow: ${selected.matchedRule?.path}`,
+ },
+ ]
+
+ if (robots.sitemaps.length) {
+ issues.push({
+ level: 'info',
+ message: `${robots.sitemaps.length} sitemap hint(s) found`,
+ details: robots.sitemaps.slice(0, 3).join(', '),
+ })
+ }
+
+ return {
+ error: null,
+ result: {
+ robotsUrl,
+ path,
+ userAgent,
+ allowed: selected.allowed,
+ matchedRule: selected.matchedRule,
+ groupAgents: selected.groupAgents,
+ tests,
+ sitemaps: robots.sitemaps,
+ issues,
+ },
+ }
+ } catch (error) {
+ return {
+ error: `Robots.txt test failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+}
+
+function extractSitemapUrls(xml: string, baseUrl: string): string[] {
+ return Array.from(xml.matchAll(/<loc>\s*([\s\S]*?)\s*<\/loc>/gi))
+ .map((match) => decodeHtml(match[1]))
+ .map((value) => {
+ try {
+ return new URL(value, baseUrl).toString()
+ } catch {
+ return null
+ }
+ })
+ .filter((value): value is string => Boolean(value))
+}
+
+async function checkBrokenLinks(formData: FormData): Promise<ToolActionData> {
+ let page
+
+ try {
+ page = await fetchPageHtml(getFormValue(formData))
+ } catch (error) {
+ return {
+ error: `Broken link check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+
+ try {
+ const { url, response, html } = page
+ const contentType = response.headers.get('content-type') || ''
+ const looksLikeSitemap =
+ contentType.includes('xml') ||
+ url.toLowerCase().includes('sitemap') ||
+ /^\s*<\?xml/i.test(html)
+ const baseHost = new URL(response.url).hostname
+ const invalidLinks: Array<{
+ href: string | null
+ anchor: string
+ issue: string
+ }> = []
+ let anchors: AnchorEntry[] = []
+ let urlsToCheck: Array<{
+ url: string
+ anchor: string
+ kind: 'internal' | 'external'
+ }> = []
+
+ if (looksLikeSitemap) {
+ urlsToCheck = extractSitemapUrls(html, response.url)
+ .slice(0, LINK_CHECK_LIMIT)
+ .map((sitemapUrl) => ({
+ url: sitemapUrl,
+ anchor: 'Sitemap URL',
+ kind:
+ new URL(sitemapUrl).hostname === baseHost ? 'internal' : 'external',
+ }))
+ } else {
+ anchors = extractAnchors(html, response.url)
+ invalidLinks.push(
+ ...anchors
+ .filter((anchor) => anchor.kind === 'invalid')
+ .map((anchor) => ({
+ href: anchor.href,
+ anchor: anchor.anchor,
+ issue: anchor.href ? 'Invalid URL' : 'Missing href',
+ })),
+ )
+
+ const seen = new Set<string>()
+ urlsToCheck = anchors
+ .filter(
+ (
+ anchor,
+ ): anchor is AnchorEntry & {
+ url: string
+ kind: 'internal' | 'external'
+ } =>
+ Boolean(anchor.url) &&
+ (anchor.kind === 'internal' || anchor.kind === 'external'),
+ )
+ .filter((anchor) => {
+ const key = anchor.url.split('#')[0]
+ if (seen.has(key)) return false
+ seen.add(key)
+ return true
+ })
+ .slice(0, LINK_CHECK_LIMIT)
+ .map((anchor) => ({
+ url: anchor.url.split('#')[0],
+ anchor: anchor.anchor,
+ kind: anchor.kind,
+ }))
+ }
+
+ const checked = await mapLimited(urlsToCheck, 8, async (link) => {
+ const trace = await traceStatus(link.url, 5)
+ return {
+ url: link.url,
+ anchor: link.anchor,
+ kind: link.kind,
+ status: trace.status,
+ finalUrl: trace.finalUrl,
+ redirectCount: trace.redirectCount,
+ issue: classifyLinkIssue(trace),
+ error: trace.error,
+ }
+ })
+
+ const brokenCount = checked.filter((link) =>
+ ['Failed', 'Server error', 'Broken', 'HTTP error'].includes(link.issue),
+ ).length
+ const redirectCount = checked.filter(
+ (link) => link.redirectCount > 0,
+ ).length
+ const emptyAnchorCount = anchors.filter((anchor) => anchor.isEmpty).length
+ const issues: Issue[] = []
+
+ if (brokenCount) {
+ issues.push({
+ level: 'error',
+ message: `${brokenCount} broken or failing link(s) found`,
+ details:
+ 'Fix 404, 410, 5xx, and failed links before search engines or users hit them.',
+ })
+ }
+
+ if (redirectCount) {
+ issues.push({
+ level: 'info',
+ message: `${redirectCount} checked link(s) redirect`,
+ details:
+ 'Update internal links to their final destinations when possible.',
+ })
+ }
+
+ if (emptyAnchorCount) {
+ issues.push({
+ level: 'warning',
+ message: `${emptyAnchorCount} empty anchor(s) found`,
+ details:
+ 'Empty anchor text is hard for users and crawlers to understand.',
+ })
+ }
+
+ if (invalidLinks.length) {
+ issues.push({
+ level: 'warning',
+ message: `${invalidLinks.length} invalid link(s) found`,
+ details:
+ 'Links with missing or invalid href values should be cleaned up.',
+ })
+ }
+
+ if (!issues.length) {
+ issues.push({
+ level: 'good',
+ message: 'Checked links look healthy',
+ details: 'No broken links were detected within the scan limit.',
+ })
+ }
+
+ return {
+ error: null,
+ result: {
+ sourceUrl: url,
+ finalUrl: response.url,
+ sourceType: looksLikeSitemap ? 'sitemap' : 'page',
+ totalLinks: looksLikeSitemap
+ ? extractSitemapUrls(html, response.url).length
+ : anchors.length,
+ checkedLinks: checked.length,
+ internalCount: checked.filter((link) => link.kind === 'internal')
+ .length,
+ externalCount: checked.filter((link) => link.kind === 'external')
+ .length,
+ brokenCount,
+ redirectCount,
+ emptyAnchorCount,
+ invalidUrlCount: invalidLinks.length,
+ links: checked,
+ invalidLinks: invalidLinks.slice(0, 20),
+ issues,
+ limit: LINK_CHECK_LIMIT,
+ },
+ }
+ } catch (error) {
+ return {
+ error: `Broken link check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+}
+
+function extractHreflangTags(html: string, baseUrl: string) {
+ return (html.match(/<link\b[^>]*>/gi) || [])
+ .filter((tag) => /\brel\s*=\s*["'][^"']*\balternate\b[^"']*["']/i.test(tag))
+ .map((tag) => {
+ const hreflang = getAttribute(tag, 'hreflang')
+ const href = getAttribute(tag, 'href')
+ let absoluteUrl: string | null = null
+
+ if (href) {
+ try {
+ absoluteUrl = new URL(href, baseUrl).toString()
+ } catch {
+ absoluteUrl = null
+ }
+ }
+
+ return {
+ hreflang,
+ href,
+ absoluteUrl,
+ isAbsolute: Boolean(href && /^https?:\/\//i.test(href)),
+ }
+ })
+ .filter((tag) => tag.hreflang || tag.href)
+}
+
+function isValidHreflang(value: string | null): boolean {
+ if (!value) return false
+ if (value.toLowerCase() === 'x-default') return true
+ return /^[a-z]{2,3}(-[A-Za-z]{4})?(-[A-Z]{2}|-[0-9]{3})?$/i.test(value)
+}
+
+async function checkHreflang(formData: FormData): Promise<ToolActionData> {
+ let page
+
+ try {
+ page = await fetchPageHtml(getFormValue(formData))
+ } catch (error) {
+ return {
+ error: `Hreflang check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+
+ try {
+ const { url, response, html } = page
+ const finalUrl = response.url
+ const tags = extractHreflangTags(html, finalUrl)
+ const canonical = findCanonical(html, finalUrl)
+ const languageCounts = new Map<string, number>()
+ const issues: Issue[] = []
+
+ for (const tag of tags) {
+ if (tag.hreflang) {
+ languageCounts.set(
+ tag.hreflang.toLowerCase(),
+ (languageCounts.get(tag.hreflang.toLowerCase()) || 0) + 1,
+ )
+ }
+ }
+
+ const invalidTags = tags.filter((tag) => !isValidHreflang(tag.hreflang))
+ const duplicateLanguages = Array.from(languageCounts.entries()).filter(
+ ([, count]) => count > 1,
+ )
+ const relativeTags = tags.filter((tag) => tag.href && !tag.isAbsolute)
+
+ if (!tags.length) {
+ issues.push({
+ level: 'info',
+ message: 'No hreflang tags found',
+ details:
+ 'This is fine for a single-language page, but international pages should declare alternates.',
+ })
+ }
+
+ if (invalidTags.length) {
+ issues.push({
+ level: 'error',
+ message: `${invalidTags.length} invalid hreflang value(s)`,
+ details:
+ 'Use ISO language codes such as en, en-GB, fr-FR, or x-default.',
+ })
+ }
+
+ if (duplicateLanguages.length) {
+ issues.push({
+ level: 'warning',
+ message: `${duplicateLanguages.length} duplicate hreflang value(s)`,
+ details: duplicateLanguages.map(([language]) => language).join(', '),
+ })
+ }
+
+ if (tags.length && !languageCounts.has('x-default')) {
+ issues.push({
+ level: 'info',
+ message: 'x-default is missing',
+ details:
+ 'x-default helps search engines pick a fallback page for unmatched languages.',
+ })
+ }
+
+ if (relativeTags.length) {
+ issues.push({
+ level: 'warning',
+ message: `${relativeTags.length} relative hreflang URL(s)`,
+ details: 'Absolute URLs are clearer for hreflang clusters.',
+ })
+ }
+
+ if (canonical.absolute && canonical.absolute !== finalUrl) {
+ issues.push({
+ level: 'warning',
+ message: 'Canonical points away from this page',
+ details:
+ 'A hreflang page should usually canonicalize to itself, not to another language version.',
+ })
+ }
+
+ const reciprocalChecks = await mapLimited(
+ tags
+ .filter((tag) => tag.absoluteUrl && tag.absoluteUrl !== finalUrl)
+ .slice(0, 5),
+ 3,
+ async (tag) => {
+ try {
+ const target = await fetchPageHtml(tag.absoluteUrl || '')
+ const targetTags = extractHreflangTags(
+ target.html,
+ target.response.url,
+ )
+ const hasReturnTag = targetTags.some(
+ (targetTag) => targetTag.absoluteUrl === finalUrl,
+ )
+
+ return {
+ url: tag.absoluteUrl,
+ status: target.response.status,
+ hasReturnTag,
+ error: null,
+ }
+ } catch (error) {
+ return {
+ url: tag.absoluteUrl,
+ status: null,
+ hasReturnTag: false,
+ error: getErrorMessage(error),
+ }
+ }
+ },
+ )
+
+ const missingReturnTags = reciprocalChecks.filter(
+ (check) => !check.hasReturnTag,
+ )
+
+ if (missingReturnTags.length) {
+ issues.push({
+ level: 'warning',
+ message: `${missingReturnTags.length} reciprocal hint(s) not confirmed`,
+ details:
+ 'Each alternate URL should usually point back to this page in the hreflang cluster.',
+ })
+ }
+
+ if (!issues.some((issue) => issue.level !== 'info')) {
+ issues.unshift({
+ level: 'good',
+ message: 'Hreflang tags look consistent',
+ details:
+ 'No duplicate, invalid, or conflicting hreflang signals were detected.',
+ })
+ }
+
+ return {
+ error: null,
+ result: {
+ requestedUrl: url,
+ finalUrl,
+ status: response.status,
+ canonical: canonical.absolute,
+ tags,
+ invalidCount: invalidTags.length,
+ duplicateCount: duplicateLanguages.length,
+ hasXDefault: languageCounts.has('x-default'),
+ reciprocalChecks,
+ issues,
+ },
+ }
+ } catch (error) {
+ return {
+ error: `Hreflang check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+}
+
+async function checkOnPageSeo(formData: FormData): Promise<ToolActionData> {
+ let page
+
+ try {
+ page = await fetchPageHtml(getFormValue(formData))
+ } catch (error) {
+ return {
+ error: `On-page SEO check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+
+ try {
+ const { url, response, html } = page
+ const finalUrl = response.url
+ const title = extractTitle(html)
+ const description = findMetaContent(html, 'description')
+ const canonical = findCanonical(html, finalUrl)
+ const robots = findAllMetaContent(html, ['robots', 'googlebot']).join(', ')
+ const h1 = Array.from(html.matchAll(/<h1\b[^>]*>([\s\S]*?)<\/h1>/gi)).map(
+ (match) => stripTags(match[1]),
+ )
+ const h2 = Array.from(html.matchAll(/<h2\b[^>]*>([\s\S]*?)<\/h2>/gi)).map(
+ (match) => stripTags(match[1]),
+ )
+ const text = stripTags(html)
+ const words = text ? text.split(/\s+/).filter(Boolean) : []
+ const images = extractImageTags(html, finalUrl)
+ const anchors = extractAnchors(html, finalUrl)
+ const htmlBytes = new TextEncoder().encode(html).length
+ const textBytes = new TextEncoder().encode(text).length
+ const textHtmlRatio = htmlBytes ? (textBytes / htmlBytes) * 100 : 0
+ const structuredDataCount =
+ (
+ html.match(/<script\b[^>]*type=["'][^"']*ld\+json[^"']*["'][^>]*>/gi) ||
+ []
+ ).length + (html.match(/\sitemscope(\s|>|=)/gi) || []).length
+ const openGraphCount = (
+ html.match(/<meta\b[^>]*(property|name)=["']og:/gi) || []
+ ).length
+ const internalLinks = anchors.filter((anchor) => anchor.kind === 'internal')
+ const externalLinks = anchors.filter((anchor) => anchor.kind === 'external')
+ const missingAlt = images.filter((image) => !image.hasAlt).length
+ const emptyAlt = images.filter(
+ (image) => image.hasAlt && image.alt === '',
+ ).length
+ const issues: Issue[] = []
+
+ issues.push(getStatusIssue(response.status, null))
+
+ if (!title) {
+ issues.push({
+ level: 'error',
+ message: 'Title tag is missing',
+ details: 'Every indexable page should have a unique title.',
+ })
+ } else if (title.length < 20 || title.length > 65) {
+ issues.push({
+ level: 'warning',
+ message: 'Title length needs review',
+ details: `${title.length} characters. Aim for a descriptive title that fits search results.`,
+ })
+ }
+
+ if (!description) {
+ issues.push({
+ level: 'warning',
+ message: 'Meta description is missing',
+ details: 'Descriptions can improve search result click-through rate.',
+ })
+ } else if (description.length < 70 || description.length > 165) {
+ issues.push({
+ level: 'info',
+ message: 'Meta description length needs review',
+ details: `${description.length} characters. Search engines may rewrite long or short descriptions.`,
+ })
+ }
+
+ if (h1.length !== 1) {
+ issues.push({
+ level: h1.length === 0 ? 'warning' : 'info',
+ message: h1.length === 0 ? 'H1 is missing' : 'Multiple H1 headings',
+ details: `Found ${h1.length} H1 heading(s).`,
+ })
+ }
+
+ if (!canonical.absolute) {
+ issues.push({
+ level: 'warning',
+ message: 'Canonical URL is missing',
+ details:
+ 'A self-referencing canonical helps reduce duplicate URL ambiguity.',
+ })
+ }
+
+ if (hasNoDirective(robots, 'noindex')) {
+ issues.push({
+ level: 'error',
+ message: 'Page is marked noindex',
+ details: 'Search engines are instructed not to index this page.',
+ })
+ }
+
+ if (words.length < 250) {
+ issues.push({
+ level: 'info',
+ message: 'Low visible word count',
+ details: `${words.length} words were detected after stripping markup.`,
+ })
+ }
+
+ if (images.length && missingAlt + emptyAlt > 0) {
+ issues.push({
+ level: 'warning',
+ message: `${missingAlt + emptyAlt} image alt issue(s)`,
+ details:
+ 'Use descriptive alt text for meaningful images and empty alt for decorative images.',
+ })
+ }
+
+ if (!structuredDataCount) {
+ issues.push({
+ level: 'info',
+ message: 'No structured data detected',
+ details: 'JSON-LD schema can help search engines understand the page.',
+ })
+ }
+
+ if (!openGraphCount) {
+ issues.push({
+ level: 'info',
+ message: 'Open Graph tags are missing',
+ details: 'Open Graph tags improve social sharing previews.',
+ })
+ }
+
+ return {
+ error: null,
+ result: {
+ requestedUrl: url,
+ finalUrl,
+ status: response.status,
+ title,
+ titleLength: title?.length || 0,
+ description,
+ descriptionLength: description?.length || 0,
+ h1,
+ h2: h2.slice(0, 12),
+ canonical: canonical.absolute,
+ robots: robots || null,
+ wordCount: words.length,
+ imageCount: images.length,
+ imagesMissingAlt: missingAlt,
+ imagesEmptyAlt: emptyAlt,
+ internalLinks: internalLinks.length,
+ externalLinks: externalLinks.length,
+ structuredDataCount,
+ openGraphCount,
+ textHtmlRatio: Number(textHtmlRatio.toFixed(1)),
+ issues,
+ },
+ }
+ } catch (error) {
+ return {
+ error: `On-page SEO check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+}
+
+async function fetchImageSize(url: string): Promise<{
+ bytes: number | null
+ contentType: string | null
+}> {
+ try {
+ const response = await fetchWithTimeout(
+ url,
+ { method: 'HEAD', redirect: 'follow' },
+ 7000,
+ )
+ await response.body?.cancel().catch(() => {})
+ const length = response.headers.get('content-length')
+ const parsed = length ? parseInt(length, 10) : NaN
+
+ return {
+ bytes: Number.isFinite(parsed) ? parsed : null,
+ contentType: response.headers.get('content-type'),
+ }
+ } catch {
+ return {
+ bytes: null,
+ contentType: null,
+ }
+ }
+}
+
+function formatBytes(bytes: number | null): string {
+ if (bytes === null) return 'Unknown'
+ if (bytes < 1024) return `${bytes} B`
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`
+ return `${(bytes / (1024 * 1024)).toFixed(2)} MB`
+}
+
+async function checkImageSeo(formData: FormData): Promise<ToolActionData> {
+ let page
+
+ try {
+ page = await fetchPageHtml(getFormValue(formData))
+ } catch (error) {
+ return {
+ error: `Image SEO check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+
+ try {
+ const { url, response, html } = page
+ const images = extractImageTags(html, response.url)
+ const headTargets = images
+ .filter((image) => image.src)
+ .slice(0, IMAGE_HEAD_LIMIT)
+ const sizes = await mapLimited(headTargets, 6, async (image) => ({
+ src: image.src,
+ ...(await fetchImageSize(image.src || '')),
+ }))
+ const sizeMap = new Map(sizes.map((size) => [size.src, size]))
+ const rows = images.slice(0, 80).map((image) => {
+ const size = image.src ? sizeMap.get(image.src) : null
+ return {
+ ...image,
+ bytes: size?.bytes ?? null,
+ size: formatBytes(size?.bytes ?? null),
+ contentType: size?.contentType ?? null,
+ isLarge: (size?.bytes ?? 0) > 300 * 1024,
+ hasDimensions: Boolean(image.width && image.height),
+ isModernFormat: ['webp', 'avif', 'svg'].includes(image.format),
+ }
+ })
+ const missingAlt = rows.filter((image) => !image.hasAlt).length
+ const emptyAlt = rows.filter(
+ (image) => image.hasAlt && image.alt === '',
+ ).length
+ const missingDimensions = rows.filter(
+ (image) => !image.hasDimensions,
+ ).length
+ const lazyImages = rows.filter((image) => image.loading === 'lazy').length
+ const largeImages = rows.filter((image) => image.isLarge).length
+ const modernFormats = rows.filter((image) => image.isModernFormat).length
+ const issues: Issue[] = []
+
+ if (!rows.length) {
+ issues.push({
+ level: 'info',
+ message: 'No image tags found',
+ details: 'The scan did not detect standard img tags in the HTML.',
+ })
+ }
+
+ if (missingAlt) {
+ issues.push({
+ level: 'warning',
+ message: `${missingAlt} image(s) missing alt attributes`,
+ details:
+ 'Meaningful images should describe their content for accessibility and SEO.',
+ })
+ }
+
+ if (emptyAlt) {
+ issues.push({
+ level: 'info',
+ message: `${emptyAlt} image(s) have empty alt text`,
+ details:
+ 'Empty alt is correct for decorative images, but review content images.',
+ })
+ }
+
+ if (missingDimensions) {
+ issues.push({
+ level: 'info',
+ message: `${missingDimensions} image(s) missing width or height`,
+ details:
+ 'Dimensions help browsers reserve space and reduce layout shift.',
+ })
+ }
+
+ if (largeImages) {
+ issues.push({
+ level: 'warning',
+ message: `${largeImages} large image(s) found`,
+ details:
+ 'Images over 300 KB can slow down landing pages, especially on mobile.',
+ })
+ }
+
+ if (!issues.length) {
+ issues.push({
+ level: 'good',
+ message: 'Image basics look healthy',
+ details:
+ 'Alt attributes, dimensions, and known image sizes look reasonable.',
+ })
+ }
+
+ return {
+ error: null,
+ result: {
+ requestedUrl: url,
+ finalUrl: response.url,
+ status: response.status,
+ imageCount: images.length,
+ checkedImages: headTargets.length,
+ missingAlt,
+ emptyAlt,
+ missingDimensions,
+ lazyImages,
+ largeImages,
+ modernFormats,
+ images: rows
+ .sort((a, b) => (b.bytes || 0) - (a.bytes || 0))
+ .slice(0, 30),
+ issues,
+ },
+ }
+ } catch (error) {
+ return {
+ error: `Image SEO check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+}
+
+async function analyzeInternalLinks(
+ formData: FormData,
+): Promise<ToolActionData> {
+ let page
+
+ try {
+ page = await fetchPageHtml(getFormValue(formData))
+ } catch (error) {
+ return {
+ error: `Internal link analysis failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+
+ try {
+ const { url, response, html } = page
+ const anchors = extractAnchors(html, response.url)
+ const internal = anchors.filter((anchor) => anchor.kind === 'internal')
+ const external = anchors.filter((anchor) => anchor.kind === 'external')
+ const nofollow = anchors.filter((anchor) =>
+ anchor.rel.toLowerCase().split(/\s+/).includes('nofollow'),
+ )
+ const sponsored = anchors.filter((anchor) =>
+ anchor.rel.toLowerCase().split(/\s+/).includes('sponsored'),
+ )
+ const ugc = anchors.filter((anchor) =>
+ anchor.rel.toLowerCase().split(/\s+/).includes('ugc'),
+ )
+ const fragments = anchors.filter((anchor) => anchor.kind === 'fragment')
+ const mailto = anchors.filter((anchor) => anchor.kind === 'mailto')
+ const tel = anchors.filter((anchor) => anchor.kind === 'tel')
+ const emptyAnchors = anchors.filter((anchor) => anchor.isEmpty)
+ const duplicateAnchorMap = new Map<string, Set<string>>()
+
+ for (const anchor of anchors) {
+ if (!anchor.anchor || !anchor.url) continue
+ const key = anchor.anchor.toLowerCase()
+ const urls = duplicateAnchorMap.get(key) || new Set<string>()
+ urls.add(anchor.url)
+ duplicateAnchorMap.set(key, urls)
+ }
+
+ const duplicateAnchors = Array.from(duplicateAnchorMap.entries())
+ .filter(([, urls]) => urls.size > 1)
+ .map(([anchor, urls]) => ({
+ anchor,
+ urls: Array.from(urls).slice(0, 5),
+ count: urls.size,
+ }))
+ .slice(0, 15)
+ const issues: Issue[] = []
+
+ if (!internal.length) {
+ issues.push({
+ level: 'warning',
+ message: 'No internal links found',
+ details:
+ 'Internal links help crawlers discover related pages and distribute page authority.',
+ })
+ }
+
+ if (emptyAnchors.length) {
+ issues.push({
+ level: 'warning',
+ message: `${emptyAnchors.length} empty anchor(s) found`,
+ details: 'Use descriptive anchor text for links that matter.',
+ })
+ }
+
+ if (duplicateAnchors.length) {
+ issues.push({
+ level: 'info',
+ message: `${duplicateAnchors.length} duplicate anchor pattern(s)`,
+ details:
+ 'The same anchor text points to multiple URLs. This can be fine, but ambiguous anchors deserve review.',
+ })
+ }
+
+ if (!issues.length) {
+ issues.push({
+ level: 'good',
+ message: 'Internal link structure looks readable',
+ details:
+ 'The page has internal links and no obvious empty-anchor issues.',
+ })
+ }
+
+ return {
+ error: null,
+ result: {
+ requestedUrl: url,
+ finalUrl: response.url,
+ status: response.status,
+ totalLinks: anchors.length,
+ internalCount: internal.length,
+ externalCount: external.length,
+ nofollowCount: nofollow.length,
+ sponsoredCount: sponsored.length,
+ ugcCount: ugc.length,
+ fragmentCount: fragments.length,
+ mailtoCount: mailto.length,
+ telCount: tel.length,
+ emptyAnchorCount: emptyAnchors.length,
+ duplicateAnchors,
+ links: anchors.slice(0, 100).map((anchor) => ({
+ url: anchor.url || anchor.href || '',
+ anchor: anchor.anchor,
+ rel: anchor.rel,
+ kind: anchor.kind,
+ isEmpty: anchor.isEmpty,
+ })),
+ issues,
+ },
+ }
+ } catch (error) {
+ return {
+ error: `Internal link analysis failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+}
+
+async function checkAiCrawlability(
+ formData: FormData,
+): Promise<ToolActionData> {
+ let home
+
+ try {
+ home = await fetchPageHtml(getFormValue(formData))
+ } catch (error) {
+ return {
+ error: `AI crawlability check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+
+ try {
+ const { url, response, html } = home
+ const origin = getOrigin(response.url)
+ const robots = await fetchRobotsForUrl(response.url)
+ const path = `${new URL(response.url).pathname}${new URL(response.url).search}`
+ const crawlerRules = AI_CRAWLERS.map((crawler) => ({
+ crawler,
+ ...testRobotsRule(robots.data, crawler, path),
+ }))
+ const llms = await traceStatus(`${origin}/llms.txt`, 2)
+ const llmsFull = await traceStatus(`${origin}/llms-full.txt`, 2)
+ const sitemapUrl = robots.data?.sitemaps[0] || `${origin}/sitemap.xml`
+ const sitemap = await traceStatus(sitemapUrl, 2)
+ const canonical = findCanonical(html, response.url)
+ const title = extractTitle(html)
+ const description = findMetaContent(html, 'description')
+ const structuredDataCount =
+ (
+ html.match(/<script\b[^>]*type=["'][^"']*ld\+json[^"']*["'][^>]*>/gi) ||
+ []
+ ).length + (html.match(/\sitemscope(\s|>|=)/gi) || []).length
+ const blockedCrawlers = crawlerRules.filter((rule) => !rule.allowed)
+ const issues: Issue[] = []
+
+ if (blockedCrawlers.length) {
+ issues.push({
+ level: 'info',
+ message: `${blockedCrawlers.length} AI crawler(s) blocked by robots.txt`,
+ details:
+ 'Blocking AI crawlers can be intentional. Review whether this matches your content strategy.',
+ })
+ } else {
+ issues.push({
+ level: 'good',
+ message: 'Common AI crawler rules allow the homepage path',
+ details: 'No blocking robots.txt rule matched the checked AI crawlers.',
+ })
+ }
+
+ if (llms.status !== 200) {
+ issues.push({
+ level: 'info',
+ message: 'llms.txt was not found',
+ details:
+ 'llms.txt is an emerging convention for summarizing useful content for AI systems.',
+ })
+ }
+
+ if (sitemap.status !== 200) {
+ issues.push({
+ level: 'warning',
+ message: 'Sitemap was not confirmed',
+ details: 'Sitemaps help crawlers discover canonical page URLs.',
+ })
+ }
+
+ if (!canonical.absolute) {
+ issues.push({
+ level: 'warning',
+ message: 'Canonical URL is missing',
+ details:
+ 'Canonical clarity helps search and AI crawlers pick the main URL.',
+ })
+ }
+
+ if (!title || !description) {
+ issues.push({
+ level: 'warning',
+ message: 'Title or description is missing',
+ details:
+ 'Readable page summaries help both search snippets and AI retrieval systems.',
+ })
+ }
+
+ if (!structuredDataCount) {
+ issues.push({
+ level: 'info',
+ message: 'No structured data detected',
+ details:
+ 'Structured data can help machines understand entities, products, articles, and organizations.',
+ })
+ }
+
+ return {
+ error: null,
+ result: {
+ requestedUrl: url,
+ finalUrl: response.url,
+ status: response.status,
+ robotsUrl: robots.robotsUrl,
+ robotsStatus: robots.status,
+ crawlerRules,
+ llms: {
+ url: `${origin}/llms.txt`,
+ status: llms.status,
+ finalUrl: llms.finalUrl,
+ },
+ llmsFull: {
+ url: `${origin}/llms-full.txt`,
+ status: llmsFull.status,
+ finalUrl: llmsFull.finalUrl,
+ },
+ sitemap: {
+ url: sitemapUrl,
+ status: sitemap.status,
+ finalUrl: sitemap.finalUrl,
+ },
+ canonical: canonical.absolute,
+ title,
+ description,
+ structuredDataCount,
+ issues,
+ },
+ }
+ } catch (error) {
+ return {
+ error: `AI crawlability check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+}
+
+function parseUrlList(value: string, limit: number): string[] {
+ const urls = value
+ .split(/[\s,]+/)
+ .map((entry) => entry.trim())
+ .filter(Boolean)
+ .map(normalizeUrl)
+
+ return Array.from(new Set(urls)).slice(0, limit)
+}
+
+function csvEscape(value: unknown): string {
+ const stringValue = String(value ?? '')
+ if (!/[",\n]/.test(stringValue)) return stringValue
+ return `"${stringValue.replace(/"/g, '""')}"`
+}
+
+function buildCsv(rows: Array<Record<string, unknown>>, columns: string[]) {
+ return [
+ columns.join(','),
+ ...rows.map((row) =>
+ columns.map((column) => csvEscape(row[column])).join(','),
+ ),
+ ].join('\n')
+}
+
+async function checkBulkStatuses(formData: FormData): Promise<ToolActionData> {
+ let urls: string[]
+
+ try {
+ urls = parseUrlList(
+ getFormText(formData, 'urls') || getFormValue(formData),
+ STATUS_LIMIT,
+ )
+ } catch (error) {
+ return { error: getErrorMessage(error), result: null }
+ }
+
+ if (!urls.length) {
+ return { error: 'Please enter at least one URL', result: null }
+ }
+
+ try {
+ const rows = await mapLimited(urls, 8, async (url) => {
+ const trace = await traceStatus(url, 6)
+ return {
+ url,
+ status: trace.status,
+ finalUrl: trace.finalUrl,
+ redirectCount: trace.redirectCount,
+ contentType: trace.contentType,
+ issue: classifyLinkIssue(trace),
+ error: trace.error,
+ }
+ })
+ const columns = [
+ 'url',
+ 'status',
+ 'finalUrl',
+ 'redirectCount',
+ 'contentType',
+ 'issue',
+ 'error',
+ ]
+ const errors = rows.filter((row) =>
+ ['Failed', 'Server error', 'Broken', 'HTTP error'].includes(row.issue),
+ ).length
+ const redirects = rows.filter((row) => row.redirectCount > 0).length
+ const issues: Issue[] = []
+
+ if (errors) {
+ issues.push({
+ level: 'error',
+ message: `${errors} URL(s) need attention`,
+ details: 'Review failed, 4xx, and 5xx responses first.',
+ })
+ }
+
+ if (redirects) {
+ issues.push({
+ level: 'info',
+ message: `${redirects} URL(s) redirect`,
+ details:
+ 'Redirects can be valid, but bulk checks are useful for spotting unexpected chains.',
+ })
+ }
+
+ if (!issues.length) {
+ issues.push({
+ level: 'good',
+ message: 'All checked URLs are reachable',
+ details: 'No broken or failing statuses were detected.',
+ })
+ }
+
+ return {
+ error: null,
+ result: {
+ checked: rows.length,
+ limit: STATUS_LIMIT,
+ ok: rows.filter((row) => row.status && row.status < 300).length,
+ redirects,
+ errors,
+ rows,
+ csv: buildCsv(rows, columns),
+ issues,
+ },
+ }
+ } catch (error) {
+ return {
+ error: `Bulk status check failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+}
+
+function parseCsvLine(line: string): string[] {
+ const values: string[] = []
+ let current = ''
+ let quoted = false
+
+ for (let index = 0; index < line.length; index += 1) {
+ const character = line[index]
+ const next = line[index + 1]
+
+ if (character === '"' && quoted && next === '"') {
+ current += '"'
+ index += 1
+ continue
+ }
+
+ if (character === '"') {
+ quoted = !quoted
+ continue
+ }
+
+ if (character === ',' && !quoted) {
+ values.push(current.trim())
+ current = ''
+ continue
+ }
+
+ current += character
+ }
+
+ values.push(current.trim())
+ return values
+}
+
+function parseMigrationPairs(value: string) {
+ const pairs: Array<{ oldUrl: string; expectedUrl: string }> = []
+
+ for (const line of value.split(/\r?\n/)) {
+ const trimmed = line.trim()
+ if (!trimmed) continue
+
+ const parsed = trimmed.includes(',')
+ ? parseCsvLine(trimmed)
+ : trimmed.split(/\s+/)
+ const [oldValue, newValue] = parsed
+
+ if (
+ oldValue?.toLowerCase() === 'old' ||
+ oldValue?.toLowerCase() === 'old url' ||
+ oldValue?.toLowerCase() === 'old_url'
+ ) {
+ continue
+ }
+
+ if (!oldValue || !newValue) continue
+
+ pairs.push({
+ oldUrl: normalizeUrl(oldValue),
+ expectedUrl: normalizeUrl(newValue),
+ })
+
+ if (pairs.length >= STATUS_LIMIT) break
+ }
+
+ return pairs
+}
+
+function normalizeForComparison(value: string): string {
+ const url = new URL(value)
+ url.hash = ''
+ if (url.pathname !== '/' && url.pathname.endsWith('/')) {
+ url.pathname = url.pathname.slice(0, -1)
+ }
+ return url.toString()
+}
+
+function queryPreserved(oldUrl: string, finalUrl: string): boolean {
+ const oldParams = new URL(oldUrl).searchParams
+ const finalParams = new URL(finalUrl).searchParams
+
+ for (const [key, value] of oldParams.entries()) {
+ if (finalParams.get(key) !== value) return false
+ }
+
+ return true
+}
+
+async function validateMigrationRedirects(
+ formData: FormData,
+): Promise<ToolActionData> {
+ let pairs: Array<{ oldUrl: string; expectedUrl: string }>
+
+ try {
+ pairs = parseMigrationPairs(
+ getFormText(formData, 'pairs') || getFormValue(formData),
+ )
+ } catch (error) {
+ return { error: getErrorMessage(error), result: null }
+ }
+
+ if (!pairs.length) {
+ return {
+ error: 'Please enter old URL and new URL pairs',
+ result: null,
+ }
+ }
+
+ try {
+ const rows = await mapLimited(pairs, 6, async (pair) => {
+ const trace = await traceStatus(pair.oldUrl, 8)
+ const finalMatches =
+ !trace.error &&
+ normalizeForComparison(trace.finalUrl) ===
+ normalizeForComparison(pair.expectedUrl)
+ const firstStatus = trace.chain[0]?.status || null
+ const redirectType =
+ firstStatus && firstStatus >= 300 && firstStatus < 400
+ ? firstStatus
+ : null
+ const preservesQuery = queryPreserved(pair.oldUrl, trace.finalUrl)
+ const ok = Boolean(
+ finalMatches &&
+ redirectType &&
+ [301, 308].includes(redirectType) &&
+ trace.redirectCount <= 3,
+ )
+
+ return {
+ oldUrl: pair.oldUrl,
+ expectedUrl: pair.expectedUrl,
+ finalUrl: trace.finalUrl,
+ status: firstStatus,
+ redirectType: redirectType || 'none',
+ redirectCount: trace.redirectCount,
+ finalMatches,
+ preservesQuery,
+ result: ok ? 'OK' : 'Review',
+ error: trace.error,
+ }
+ })
+ const columns = [
+ 'oldUrl',
+ 'expectedUrl',
+ 'finalUrl',
+ 'status',
+ 'redirectType',
+ 'redirectCount',
+ 'finalMatches',
+ 'preservesQuery',
+ 'result',
+ 'error',
+ ]
+ const mismatches = rows.filter((row) => !row.finalMatches).length
+ const temporary = rows.filter((row) =>
+ [302, 303, 307].includes(Number(row.redirectType)),
+ ).length
+ const longChains = rows.filter((row) => row.redirectCount > 3).length
+ const queryDrops = rows.filter((row) => !row.preservesQuery).length
+ const issues: Issue[] = []
+
+ if (mismatches) {
+ issues.push({
+ level: 'error',
+ message: `${mismatches} target mismatch(es)`,
+ details:
+ 'The final redirected URL does not match the expected migration target.',
+ })
+ }
+
+ if (temporary) {
+ issues.push({
+ level: 'warning',
+ message: `${temporary} temporary redirect(s) found`,
+ details:
+ 'SEO migrations usually use 301 or 308 redirects for permanent moves.',
+ })
+ }
+
+ if (longChains) {
+ issues.push({
+ level: 'warning',
+ message: `${longChains} long redirect chain(s)`,
+ details: 'Short chains are faster and easier for crawlers to process.',
+ })
+ }
+
+ if (queryDrops) {
+ issues.push({
+ level: 'info',
+ message: `${queryDrops} URL(s) may drop query parameters`,
+ details: 'Campaign and filter parameters can be lost during redirects.',
+ })
+ }
+
+ if (!issues.length) {
+ issues.push({
+ level: 'good',
+ message: 'Migration redirects match expectations',
+ details:
+ 'Checked redirects are permanent, short, and reach the expected targets.',
+ })
+ }
+
+ return {
+ error: null,
+ result: {
+ checked: rows.length,
+ limit: STATUS_LIMIT,
+ passed: rows.filter((row) => row.result === 'OK').length,
+ mismatches,
+ temporary,
+ longChains,
+ queryDrops,
+ rows,
+ csv: buildCsv(rows, columns),
+ issues,
+ },
+ }
+ } catch (error) {
+ return {
+ error: `Migration redirect validation failed: ${getErrorMessage(error)}`,
+ result: null,
+ }
+ }
+}
+
+export async function runSeoToolAction(
+ slug: SeoToolSlug,
+ formData: FormData,
+): Promise<ToolActionData> {
+ if (slug === 'indexability-checker') return checkIndexability(formData)
+ if (slug === 'robots-txt-tester') return testRobotsTxt(formData)
+ if (slug === 'broken-link-checker') return checkBrokenLinks(formData)
+ if (slug === 'hreflang-checker') return checkHreflang(formData)
+ if (slug === 'on-page-seo-checker') return checkOnPageSeo(formData)
+ if (slug === 'image-seo-checker') return checkImageSeo(formData)
+ if (slug === 'internal-link-analyzer') return analyzeInternalLinks(formData)
+ if (slug === 'ai-search-llm-crawlability-checker') {
+ return checkAiCrawlability(formData)
+ }
+ if (slug === 'http-status-bulk-checker') return checkBulkStatuses(formData)
+ if (slug === 'seo-migration-redirect-validator') {
+ return validateMigrationRedirects(formData)
+ }
+
+ return { error: 'Unknown SEO tool', result: null }
+}
diff --git a/web/app/routes/tools.ai-search-llm-crawlability-checker.tsx b/web/app/routes/tools.ai-search-llm-crawlability-checker.tsx
new file mode 100644
index 000000000..311a04638
--- /dev/null
+++ b/web/app/routes/tools.ai-search-llm-crawlability-checker.tsx
@@ -0,0 +1,17 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+import { runTechnicalToolAction } from '~/lib/freeTools.server'
+
+const route = createTechnicalToolRoute('ai-search-llm-crawlability-checker')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export async function action({ request }: { request: Request }) {
+ return runTechnicalToolAction(
+ 'ai-search-llm-crawlability-checker',
+ await request.formData(),
+ )
+}
+
+export default route.Component
diff --git a/web/app/routes/tools.broken-link-checker.tsx b/web/app/routes/tools.broken-link-checker.tsx
new file mode 100644
index 000000000..502c22f35
--- /dev/null
+++ b/web/app/routes/tools.broken-link-checker.tsx
@@ -0,0 +1,14 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+import { runTechnicalToolAction } from '~/lib/freeTools.server'
+
+const route = createTechnicalToolRoute('broken-link-checker')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export async function action({ request }: { request: Request }) {
+ return runTechnicalToolAction('broken-link-checker', await request.formData())
+}
+
+export default route.Component
diff --git a/web/app/routes/tools.gsc-export-analyzer.tsx b/web/app/routes/tools.gsc-export-analyzer.tsx
new file mode 100644
index 000000000..5a6ae016a
--- /dev/null
+++ b/web/app/routes/tools.gsc-export-analyzer.tsx
@@ -0,0 +1,9 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+
+const route = createTechnicalToolRoute('gsc-export-analyzer')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export default route.Component
diff --git a/web/app/routes/tools.hreflang-checker.tsx b/web/app/routes/tools.hreflang-checker.tsx
new file mode 100644
index 000000000..85af112df
--- /dev/null
+++ b/web/app/routes/tools.hreflang-checker.tsx
@@ -0,0 +1,14 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+import { runTechnicalToolAction } from '~/lib/freeTools.server'
+
+const route = createTechnicalToolRoute('hreflang-checker')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export async function action({ request }: { request: Request }) {
+ return runTechnicalToolAction('hreflang-checker', await request.formData())
+}
+
+export default route.Component
diff --git a/web/app/routes/tools.http-status-bulk-checker.tsx b/web/app/routes/tools.http-status-bulk-checker.tsx
new file mode 100644
index 000000000..8f021e91c
--- /dev/null
+++ b/web/app/routes/tools.http-status-bulk-checker.tsx
@@ -0,0 +1,17 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+import { runTechnicalToolAction } from '~/lib/freeTools.server'
+
+const route = createTechnicalToolRoute('http-status-bulk-checker')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export async function action({ request }: { request: Request }) {
+ return runTechnicalToolAction(
+ 'http-status-bulk-checker',
+ await request.formData(),
+ )
+}
+
+export default route.Component
diff --git a/web/app/routes/tools.image-seo-checker.tsx b/web/app/routes/tools.image-seo-checker.tsx
new file mode 100644
index 000000000..e77776857
--- /dev/null
+++ b/web/app/routes/tools.image-seo-checker.tsx
@@ -0,0 +1,14 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+import { runTechnicalToolAction } from '~/lib/freeTools.server'
+
+const route = createTechnicalToolRoute('image-seo-checker')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export async function action({ request }: { request: Request }) {
+ return runTechnicalToolAction('image-seo-checker', await request.formData())
+}
+
+export default route.Component
diff --git a/web/app/routes/tools.indexability-checker.tsx b/web/app/routes/tools.indexability-checker.tsx
new file mode 100644
index 000000000..a7974ef62
--- /dev/null
+++ b/web/app/routes/tools.indexability-checker.tsx
@@ -0,0 +1,17 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+import { runTechnicalToolAction } from '~/lib/freeTools.server'
+
+const route = createTechnicalToolRoute('indexability-checker')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export async function action({ request }: { request: Request }) {
+ return runTechnicalToolAction(
+ 'indexability-checker',
+ await request.formData(),
+ )
+}
+
+export default route.Component
diff --git a/web/app/routes/tools.internal-link-analyzer.tsx b/web/app/routes/tools.internal-link-analyzer.tsx
new file mode 100644
index 000000000..c3cae171d
--- /dev/null
+++ b/web/app/routes/tools.internal-link-analyzer.tsx
@@ -0,0 +1,17 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+import { runTechnicalToolAction } from '~/lib/freeTools.server'
+
+const route = createTechnicalToolRoute('internal-link-analyzer')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export async function action({ request }: { request: Request }) {
+ return runTechnicalToolAction(
+ 'internal-link-analyzer',
+ await request.formData(),
+ )
+}
+
+export default route.Component
diff --git a/web/app/routes/tools.on-page-seo-checker.tsx b/web/app/routes/tools.on-page-seo-checker.tsx
new file mode 100644
index 000000000..e781f5a4a
--- /dev/null
+++ b/web/app/routes/tools.on-page-seo-checker.tsx
@@ -0,0 +1,14 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+import { runTechnicalToolAction } from '~/lib/freeTools.server'
+
+const route = createTechnicalToolRoute('on-page-seo-checker')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export async function action({ request }: { request: Request }) {
+ return runTechnicalToolAction('on-page-seo-checker', await request.formData())
+}
+
+export default route.Component
diff --git a/web/app/routes/tools.robots-txt-tester.tsx b/web/app/routes/tools.robots-txt-tester.tsx
new file mode 100644
index 000000000..4f7456bc1
--- /dev/null
+++ b/web/app/routes/tools.robots-txt-tester.tsx
@@ -0,0 +1,14 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+import { runTechnicalToolAction } from '~/lib/freeTools.server'
+
+const route = createTechnicalToolRoute('robots-txt-tester')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export async function action({ request }: { request: Request }) {
+ return runTechnicalToolAction('robots-txt-tester', await request.formData())
+}
+
+export default route.Component
diff --git a/web/app/routes/tools.seo-migration-redirect-validator.tsx b/web/app/routes/tools.seo-migration-redirect-validator.tsx
new file mode 100644
index 000000000..36d08954e
--- /dev/null
+++ b/web/app/routes/tools.seo-migration-redirect-validator.tsx
@@ -0,0 +1,17 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+import { runTechnicalToolAction } from '~/lib/freeTools.server'
+
+const route = createTechnicalToolRoute('seo-migration-redirect-validator')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export async function action({ request }: { request: Request }) {
+ return runTechnicalToolAction(
+ 'seo-migration-redirect-validator',
+ await request.formData(),
+ )
+}
+
+export default route.Component
diff --git a/web/app/routes/tools.serp-snippet-preview.tsx b/web/app/routes/tools.serp-snippet-preview.tsx
new file mode 100644
index 000000000..bcedf611c
--- /dev/null
+++ b/web/app/routes/tools.serp-snippet-preview.tsx
@@ -0,0 +1,9 @@
+import { createTechnicalToolRoute } from '~/components/tools/TechnicalToolRoute'
+
+const route = createTechnicalToolRoute('serp-snippet-preview')
+
+export const meta = route.meta
+export const sitemap = route.sitemap
+export const loader = route.loader
+
+export default route.Component