duplicate-beacon

Beacon · SEO & discoverability

duplicate-beacon

Detect duplicate and near-duplicate titles, meta descriptions and page bodies across your built static site.

npm i -D @mrlouiswright/duplicate-beacon

Published to GitHub Packages: add @mrlouiswright:registry=https://npm.pkg.github.com to .npmrc first (installing needs a token with read:packages).

What it checks

  • Titlesexact duplicates, and titles that only differ by the site name once the common | Brand suffix or prefix is removed.
  • Meta descriptionsexact duplicates, near-duplicates (template text with a word swapped), and descriptions that just repeat the title.
  • Bodiesidentical main content, and near-duplicates using 5-word shingles with MinHash/LSH candidate search and exact Jaccard similarity (--threshold, default 0.9). Navigation, header, footer and aside are left out of the main-content comparison.
  • Boilerplatepages whose text is mostly shared with many other pages (info).

Quick usage

CLI

npx duplicate-beacon dist
npx duplicate-beacon dist --threshold 0.85 --fail-on medium
npx duplicate-beacon public --ignore "/tags/**,/page/*" --min-words 80
npx duplicate-beacon out --format json > duplicates.json

API

import { check, shingles, jaccard } from "duplicate-beacon";
const report = check("dist", { threshold: 0.85 });
jaccard(shingles(a), shingles(b)); // 0..1

Every option is documented in the duplicate-beacon docs.

CI / GitHub Action

permissions:
  contents: read
  security-events: write   # only needed for the SARIF upload
jobs:
  duplicate-beacon:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
        with: { persist-credentials: false }
      - run: npm ci && npm run build   # produce the static site first
      - uses: MrLouisWright/duplicate-beacon@v1
        with:
          path: dist
          fail-on: high
          sarif: duplicate-beacon.sarif
      - uses: github/codeql-action/upload-sarif@v3
        if: always()
        with: { sarif_file: duplicate-beacon.sarif }