@softroutine/backlink-share
v0.2.0
Published
Fetch shared backlinks from an Airtable Projects table.
Readme
@softroutine/backlink-share
Fetch shared backlinks from a Softroutine Airtable Projects table and render them on your site's footer — a simple way to cross-link related products within the Softroutine portfolio.
Installation
npm install @softroutine/backlink-shareUsage
import { fetchSharedBacklinks } from '@softroutine/backlink-share';
const links = await fetchSharedBacklinks({
apiKey: process.env.AIRTABLE_API_KEY,
excludeDomain: 'yoursite.com', // optional: hide your own site from the list
});
// [{ name: 'Some Site', href: 'https://somesite.com' }, ...]Options
| Option | Type | Required | Description |
| --------------- | -------- | -------- | ----------------------------------------------------------------- |
| apiKey | string | Yes | Airtable personal access token. Throws when missing. |
| excludeDomain | string | No | Substring to filter out from results (e.g. your own domain). |
| baseId | string | No | Override the default Airtable base id. |
| tableId | string | No | Override the default Airtable table id. |
Failure behavior
This package is intentionally strict so that backlinks remain stable across builds:
- Missing
apiKey— throws immediately. Backlinks are baked into static HTML at build time; silently returning[]would cause links to disappear on the next deploy and harm SEO. - Network failure — the Airtable request is retried up to 3 times with exponential backoff (≈1s, 2s, 4s, jittered). If all 4 attempts fail, the function throws and your build will fail loudly. Catch the error at the call site only if you have a deliberate fallback strategy.
Airtable table schema
The target table must contain these fields:
| Field name | Type | Description |
| ---------------- | -------- | --------------------------------------------------- |
| Name | Text | Display name of the link |
| URL | URL | Target URL |
| Backlink Share | Checkbox | Only records with this checked are returned |
Websites using this package
License
MIT
