Skip to main content

Function: useBacklinkCounts()

useBacklinkCounts(targetUri, options): UseQueryResult<OutputSchema, Error>

Defined in: web/lib/hooks/use-backlinks.ts:129

Fetches aggregated backlink counts for an eprint.

Parameters​

targetUri​

string

AT URI of the eprint to get counts for

options​

UseBacklinkCountsOptions = {}

Query options

Returns​

UseQueryResult<OutputSchema, Error>

Query result with backlink counts

Remarks​

Returns counts by source type (Cosmik, Leaflet, Bluesky, and everything else under other). and a total count. Useful for displaying summary badges.

Example​

const { data: counts, isLoading } = useBacklinkCounts(eprintUri);
console.log(counts?.total, 'total backlinks');