Getting started

ranklint init

Generate ranklint.config.ts in one command: site url, UAT profile, zones, CI snippet and monitoring.

The first step after installing the CLI. ranklint init asks a few questions and writes ranklint.config.ts into the current directory, then loads it back with the real config loader so you know it is valid.

npx ranklint init

What it asks

  1. Site url (absolute http/https, validated).
  2. Do you need a profile for UAT/staging? The UAT url becomes profiles.uat, applied with ranklint audit --profile uat.
  3. Do several apps share this domain? The glob paths of your own section (comma separated) become apps.self, the rest of the domain becomes a foreign zone. See Zones.
  4. CI provider: gitlab, github or none. The snippet is printed, no pipeline file is created or edited.
  5. Enable scheduled production monitoring? Adds monitor with fs storage, used by ranklint audit --mode monitor.

If ranklint.config.ts already exists, init asks whether to overwrite it; the default answer is no.

What it generates

import { defineRanklintConfig } from '@ranklint/core'

export default defineRanklintConfig({
  site: { url: 'https://example.com' },
  apps: {
    self: { paths: ['/en/market/**', '/ar/market/**'] },
    main: { paths: ['/**'], owner: 'external' },
  },
  monitor: { storage: 'fs', dir: '.ranklint/reports' },
  profiles: {
    uat: { site: { url: 'https://uat.example.com' } },
  },
})

Sections you declined are simply absent: the minimal result is site alone. After writing the file init runs loadRanklintConfig and reports config is valid; when @ranklint/core is not installed yet it prints the hint npm i -D @ranklint/core instead.

Non-interactive mode

FlagDescription
--yesno prompts, requires --url
--urlproduction url of the site
--uatUAT url, generates the uat profile
--zonescomma separated globs of your own zone
--cigitlab | github | none, prints the pipeline snippet
--forceoverwrite an existing ranklint.config.ts
--cwddirectory to create the config in
npx ranklint init --yes --url https://example.com --uat https://uat.example.com --ci github

Without --yes and without a TTY the command fails with "use --yes with --url", so it never hangs in a pipeline.

CI snippets

GitLab:

include:
  - remote: 'https://raw.githubusercontent.com/aakazancev/ranklint/main/presets/gitlab-ci/seo.yml'

seo:audit:
  extends: .ranklint-audit
  variables:
    RANKLINT_URL: https://example.com

GitHub Actions (a reusable workflow, add it to .github/workflows/seo.yml):

name: seo
on: [pull_request]
jobs:
  seo:
    uses: aakazancev/ranklint/.github/workflows/seo.yml@main
    with: { url: 'https://example.com' }

More about the presets in Diff & CI.

Nuxt detection

When the directory has a nuxt.config.ts|js|mjs and @ranklint/nuxt is not in package.json, init finishes with:

Nuxt detected: npx nuxi module add @ranklint/nuxt

The module gives you sitemap, robots and JSON-LD at build time, while the CLI audits the deployed result.