Lean Auto-Links
Lightweight auto-linking engine for WordPress. Keywords, affiliates, glossary — one plugin.
by Cristian Tala · github.com/ctala/lean-autolinks · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/ctala/lean-autolinks/archive/refs/heads/main.zipLightweight, configurable auto-linking engine for WordPress. Custom keywords, affiliate links, glossary terms — all managed from one place.
Features
- Custom keyword → URL mapping with per-keyword flags
- Per-keyword
rel="sponsored"for affiliate links (Sp column) - Global
rel="nofollow"for external links — safe by default - Per-keyword dofollow override (DF column) to pass link juice when intended
- Auto-detect post types — all public CPTs enabled by default
- Configurable protected zones — skip headings, captions, blockquotes, post title
- REST API for programmatic CRUD (bulk import glossary/actors/affiliates)
- Groups for organization (custom, glosario, actores, affiliate, etc.)
- Longer terms matched first — "Venture Capital" won't be broken by "Capital"
- External links open in new tab by default (
target="_blank") - Single file, ~30KB, zero extra DB tables, zero dependencies
Installation
- Download ZIP from GitHub releases
- WP Admin → Plugins → Add New → Upload Plugin → select ZIP
- Activate
- Go to Settings → Auto-Links
Admin UI
Three tabs:
| Tab | Description |
|---|---|
| Keywords | Add/edit keywords with On/Off, URL, Group, Sp (sponsored), DF (dofollow) |
| Settings | Post types, protected zones, external link behavior, matching options |
| Stats | Summary, group breakdown, REST API reference |
How It Works
- Keywords are matched in post content using Unicode-aware regex
- Existing links, headings, code blocks, and other protected zones are skipped
- Each keyword is linked at most N times per post (configurable)
- Longer terms are matched first to prevent partial matches
- Optional plural suffix matching (e.g., "startup" also matches "startups")
Link Behavior
| Scenario | Result |
|---|---|
| Internal link | Normal <a href> |
| External link (default) | target="_blank" rel="noopener nofollow" |
| External + Sp checked | rel="noopener nofollow sponsored" |
| External + DF checked | rel="noopener" (no nofollow) |
| External + Sp + DF | rel="noopener sponsored" (dofollow + sponsored) |
REST API
All endpoints require manage_options capability (use Application Passwords).
Keywords
GET /wp-json/lean-autolinks/v1/keywords # List all (optional ?group=)
POST /wp-json/lean-autolinks/v1/keywords # Add keywords (deduplicates)
PUT /wp-json/lean-autolinks/v1/keywords # Replace all keywords
DELETE /wp-json/lean-autolinks/v1/keywords?group= # Delete by group
DELETE /wp-json/lean-autolinks/v1/keywords?term= # Delete by term
Keyword Object
{
"term": "Venture Capital",
"url": "https://example.com/venture-capital/",
"sponsored": false,
"dofollow": true,
"group": "pillar",
"active": true
}
Settings
GET /wp-json/lean-autolinks/v1/settings # Get current settings
POST /wp-json/lean-autolinks/v1/settings # Update settings (partial merge)
Cache
POST /wp-json/lean-autolinks/v1/cache/flush # Flush keyword cache
Configuration
All settings are available in Settings → Auto-Links. Key options:
| Setting | Default | Description |
|---|---|---|
| Post types | All public | Which post types to auto-link |
| Max links/post | 10 | Maximum auto-links per post |
| Max per keyword | 1 | Times same keyword can be linked per post |
| Min term length | 3 | Minimum characters for a keyword |
| Cache hours | 24 | Transient cache duration (0 = no cache) |
| External new tab | ✅ | Open external links in new tab |
| Nofollow external | ✅ | Add nofollow to external links by default |
| Skip headings | ✅ | Don't link inside H1-H6 |
| Skip captions | ✅ | Don't link inside figcaption |
| Skip blockquotes | ❌ | Don't link inside blockquote |
| Skip own title | ✅ | Don't link the post's own title |
Requirements
- WordPress 5.0+
- PHP 7.4+
License
GPL-2.0-or-later