Getting started

Installation

Install the Nuxt module and the CLI, and run the first audit.

Module

npx nuxi module add @ranklint/nuxt

Works with zero configuration: /sitemap.xml (static routes from app/pages/) and /robots.txt (non-prod environments are closed to indexing) are available right away.

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@ranklint/nuxt'],
  ranklint: {
    site: { url: 'https://example.com', name: 'Example' },
    sitemap: {
      sources: [
        '/api/seo/urls',
        async () => (await $fetch<string[]>('/api/products')).map(slug => ({ loc: `/p/${slug}` })),
      ],
      cacheTtl: 3600,
    },
    robots: { mode: 'owner' },
    jsonLd: true,
  },
})

Every block can be disabled with false — disabled code is not registered at all.

sitemap: { autoRoutes: false } drops the automatic routes collected from app/pages — use it with explicit sources when routes need locale prefixes or manual curation (i18n / multi-app setups).

A function source is serialized into the server bundle via toString(), so it must be self-contained: Nitro globals ($fetch) are available, but closures over variables and imports from nuxt.config are not.

<script setup>
useJsonLd('Product', {
  name: 'Widget',
  offers: { price: 9.99, priceCurrency: 'USD' },
})

useRanklintIgnore(['headings:single-h1'])
</script>

In dev, JSON-LD is validated against Schema.org schemas (Product, Article, BreadcrumbList, Organization, WebSite) with console warnings; in prod the validator is completely tree-shaken out of the bundle. The module's client runtime is under 1 KB gzip.

CLI

npm i -D @ranklint/cli
npx playwright install chromium

ranklint init                                          # generate ranklint.config.ts
ranklint audit --url https://uat.example.com          # audit a live site
ranklint audit --start .output/server/index.mjs        # or self-contained from a build

Exit code 1 when errors are found. Reporters: markdown (default), json, junit (--reporter, --output).

The first step after the install is ranklint init: it writes ranklint.config.ts, prints a CI snippet and detects Nuxt.

Rules are configured in ranklint.config.ts with ESLint semantics — see Configuration.