The paths a site was asked for and lacks, most hits first, with referring hosts and last request.
<div data-mount="report"></div>
Installation
// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/not-found-report.css";
import { referrerLine, windowOf, probesLine } from "capsomer/behavior/not-found-report";
import "capsomer/tokens.css";
import "capsomer/not-found-report.css";
import { NotFoundReport } from "capsomer/react/not-found-report";
Usage
import { NotFoundReport } from "capsomer/react/not-found-report";
<NotFoundReport
rows={rows}
days={days}
windows={[7, 30]}
onWindow={(d) => setSearchParams(d === 30 ? {} : { days: String(d) })}
reason={reason}
actions={(row) => <Link className="cap-btn" data-size="sm" to={`/redirects/new?from=${encodeURIComponent(row.path)}`}>Add a redirect<span className="cap-sr-only"> for {row.path}</span></Link>}
/>
Examples
One window, no actions, scanner probes counted and not listed
<div data-mount="plain"></div>
Nothing missing
<div data-mount="empty"></div>
The report cannot be read, and reading it
<div data-mount="reason"></div>
<div data-mount="loading"></div>
API reference
NotFoundReport
| Prop | Type | Required | Does |
|---|
rows | readonly NotFoundRow[] | Yes | |
|---|
days | number | Yes | The window the rows count over, in days. |
|---|
windows | readonly number[] | | The windows offered, with the change to make: a segmented control in the panel's head. |
|---|
onWindow | (days: number) => void | | |
|---|
title | ReactNode | | |
|---|
src | ReactNode | | The source line; "Last 30 days" by default. The probes not listed always follow it. |
|---|
probes | number | null | | Scanner probes the site counted and does not list. |
|---|
reason | ReactNode | | The report cannot be read: why, in a sentence. A state with a reason, never an empty list. |
|---|
loading | boolean | | |
|---|
actions | (row: NotFoundRow) => ReactNode | | A row's own actions: "Add a redirect". |
|---|
now | number | | A fixed "now" for the last-seen times. |
|---|
Functions
| Function | Signature | Does |
|---|
referrerLine | (referrers: readonly { host: string; hits: number; }[]): string | "example.com 2, no referrer 1". |
|---|
windowOf | (asked: unknown, windows: readonly number[], fallback?: number | undefined): number | The window asked for, if it is one the report offers; else the default (the last one offered). |
|---|
probesLine | (probes: number | null | undefined): string | null | What the source line says about scanner probes, counted and not listed. |
|---|
hitsWord | (n: number): string | |
|---|
Parts and data attributes
| Class | Is |
|---|
.cap-nf-meta | its own class |
|---|
.cap-nf-path | the root |
|---|
.cap-nf-reason | its own class |
|---|
Accessibility
| Key | Does |
|---|
| Tab | The window's choice, then each row and its actions |
| Arrow keys on the window | Change it; the rows follow |
| Enter on a row action | Follows or runs it |
- The panel is named by its title; the rows are a list named "Missing paths, most hits first".
- A row's action names its path ("Add a redirect for /blog/spring-update/").
- The hits and the last-seen time are text beside the path.