Author:
    Creation:2026-06-11Last update:2026-09-12

    Scan Website

    The scan command fetches a public URL, measures the total page size, and audits the page's i18n and SEO health. It produces a scored report (0–100) covering HTML attributes, canonical links, hreflang tags, robots.txt, sitemap.xml, localized internal links, and JavaScript bundle locale weight.

    No extra dependencies are required. When puppeteer is installed the scan can capture lazy-loaded JavaScript chunks for a more precise bundle analysis; otherwise it falls back to inspecting eagerly-loaded scripts declared in the HTML.

    Usage

    bash
    npx intlayer scan <url>
    

    Example

    bash
    npx intlayer scan https://example.com
    

    Sample output:

    plaintext
    🔍 Scanned https://example.com (basic mode)
    
    Score: 90/100
    Page size: 10.60 MB (HTML 42.31 KB)
    Locales: en, fr, es, de, …
    
    Checks:
      ✓ html lang attribute
      ✓ html dir attribute
      ✓ canonical link
      ✓ hreflang tags
      ✓ x-default hreflang
      ✓ localized internal links
      ⚠ all internal links localized
      ✓ current locale detected
      ✓ robots.txt present
      ✓ robots.txt keeps locale paths crawlable
      ✓ sitemap.xml present
      ✓ sitemap lists every locale
      ✓ sitemap has alternate links
      ✓ sitemap has x-default
    
    Bundle locale weight:
      Translations shipped: 120.50 KB
      Unused (other locales): 45.20 KB (37%)
    

    Options

    <url> (required)

    The fully-qualified URL to scan (e.g. https://example.com).

    --no-deep

    Disable the deeper render-based scan.

    By default the command attempts to use puppeteer to render the page in a headless browser, capture lazy-loaded JavaScript chunks, and measure the true wire-transfer size. If puppeteer is not installed, the command automatically falls back to basic mode.

    Pass --no-deep to force basic mode even when puppeteer is available.

    Example: npx intlayer scan https://example.com --no-deep

    --json

    Output the full scan result as a JSON object instead of a formatted report. Useful for programmatic consumption or CI pipelines.

    Example: npx intlayer scan https://example.com --json

    Standard configuration options

    • --base-dir — Base directory used to locate the intlayer.config.* file.
    • -e, --env — Target environment (e.g. development, production).
    • --env-file — Path to a custom .env file.
    • --no-cache — Disable configuration cache.
    • --ci — Run the command in every Intlayer project of the monorepo (or only the current one when run from a project directory). Per-project credentials can be injected via INTLAYER_PROJECT_CREDENTIALS, a JSON map of project path to { "clientId", "clientSecret" }.
    • --verbose — Enable verbose logging (default in CLI mode).
    • --prefix — Custom log prefix.

    What is checked

    CheckDescriptionScore weight
    html lang<html lang="…"> attribute is present9
    html dir<html dir="…"> attribute is present3
    canonical<link rel="canonical"> is present10
    hreflang<link rel="alternate" hreflang="…"> tags are present9
    x-default hreflangAn x-default hreflang alternate exists7
    localized linksAt least one internal link includes a locale segment5
    all links localizedEvery internal link includes a locale segment5
    current localePage locale can be detected3
    robots.txt present/robots.txt returns a 200 response10
    robots.txt locale pathsNo locale path is blocked in robots.txt10
    sitemap.xml present/sitemap.xml returns a 200 response10
    sitemap locale coverageEvery detected locale appears in the sitemap10
    sitemap alternatesThe sitemap contains hreflang alternate links5
    sitemap x-defaultThe sitemap contains an x-default hreflang5
    unused bundle contentThe JS bundle does not ship excessive unused locale data9

    The final score is the weighted sum of all passing checks expressed as a percentage (0–100).

    Using the scan function programmatically

    The scan function is also exported from @intlayer/cli so it can be called from your own scripts:

    ts
    import { scan } from "@intlayer/cli";
    
    await scan("https://example.com", {
      deep: false,
      json: false,
    });
    

    For lower-level access, scanWebsite from @intlayer/engine/scan returns a structured ScanResult object:

    ts
    import { scanWebsite } from "@intlayer/engine/scan";
    
    const result = await scanWebsite("https://example.com", { deep: false });
    console.log(result.score, result.totalPageSize, result.events);