Link Library
Link Library for Craft CMS
A highly interactive global link management and redirection engine for Craft CMS 5. usually known from the the Enterprise CMS as "Link Governance" or "Link Database", allowing you to manage promotional campaigns, tracking URLs, and redirect patterns from a single, centralized dashboard.
π Key Features
1. Centralized Asset Management (The "Single Source of Truth")
Never update a hardcoded URL on dozen different pages again.
- Create dynamic, branded short links (e.g.,
/link/spring-promo) that redirect to any internal or external target URL. - Edit the target URL once in the Link Library dashboard, and every single page referencing that link updates instantly.
- Built-in automatic slug validation ensures no overlapping paths or routing conflicts.
2. Bidirectional Reference Tracking (Dependency Mapping)
- The Implementations sidebar card automatically tracks exactly which entries, pages, and channels are referencing each global link.
- Leverages Craft's native relationship engine to map connections.
- Provides absolute administrative confidence when archiving or editing legacy links, eliminating broken links across your site.
3. Governance, Localization, and Personalization
- Analytics & Request Logger: Track total click counts with detailed real-time logs (IP Address, User Agent, Referrer URL, and accurate Click Timestamp).
- Campaign Expirations: Set dynamic expiration dates to automatically shut off redirects after a specific campaign window passes.
- Localization Controls: Tag campaign links with language tags (e.g.,
en,de,fr) to optimize regional marketing efforts. - Dynamic QR Codes: Auto-generates scannable QR codes for print or physical media campaigns, with one-click high-resolution PNG downloads.
βοΈ Requirements
This plugin requires:
- Craft CMS:
5.10.0or later - PHP:
8.3or later - Database: MySQL
8.0+or PostgreSQL13+
π Installation
You can install this plugin from the Craft Plugin Store or via Composer.
Via the Plugin Store
- Go to the Plugin Store in your projectβs Control Panel.
- Search for Link Library.
- Click the Install button.
Via Composer
Open your terminal, navigate to your project directory, and execute:
# Require the package
composer require thekitchen-agency/craft-tka-link-library
# Install and activate the plugin
./craft plugin/install tka-link-library
π οΈ Configuration & Settings
Link Library allows global custom routing setups. Go to Settings β Link Library in your Craft Control Panel:
- Custom Short Link Prefix: Specify the routing base for your short links (e.g.,
link,go, or leave it blank to serve short links directly from the root domain). - Default Redirect Status: Choose the HTTP redirection status code (e.g.,
301 Moved Permanentlyfor SEO optimization or302 Foundfor temporary marketing campaigns).
π§© The "Link Selection" Custom Field
Link Library ships with a native Link Selection custom field. This allows content editors to seamlessly select global links directly from inside their entry forms.
Creating the Field
- Go to Settings β Fields and click New Field.
- Set the Name (e.g., "Campaign Link") and Handle (
campaignLink). - Under Field Type, select Link Selection.
- Save the field and add it to any Entry Type layout.
π» Twig Template Usage
Once an editor associates a Link with an entry, you can render its properties effortlessly in your frontend templates.
1. Rendering Related Links from an Entry Field
When retrieving a LinkSelection field, it returns an element query that you can fetch:
{# Fetch the related Link element #}
{% set linkRelation = entry.campaignLink.one() %}
{% if linkRelation %}
<div class="campaign-banner">
<h3>{{ linkRelation.title }}</h3>
{# Output the short redirection URL #}
<a href="{{ linkRelation.getShortUrl() }}" class="btn">
Get the Deal!
</a>
{# Output the original destination URL if needed #}
<p>Redirects to: <code>{{ linkRelation.originalUrl }}</code></p>
{# Display campaign metadata #}
{% if linkRelation.isExpired() %}
<span class="badge expired">Expired Campaign</span>
{% endif %}
</div>
{% endif %}
2. Fetching Links Globally via the Craft Variable
You can query global campaign links directly from any template using the craft.tkaLink helper:
{# Retrieve a single link by its unique short slug #}
{% set springLink = craft.tkaLink.get('spring-promo') %}
{% if springLink and not springLink.isExpired() %}
<a href="{{ springLink.getShortUrl() }}">
Check out our Spring Promotion!
</a>
{% endif %}
{# Loop through all global links #}
{% set allCampaigns = craft.tkaLink.all() %}
<ul>
{% for campaign in allCampaigns %}
<li>
<strong>{{ campaign.title }}</strong>:
<a href="{{ campaign.getShortUrl() }}">{{ campaign.shortSlug }}</a>
({{ campaign.clicks }} clicks)
</li>
{% endfor %}
</ul>
3. Outputting Dynamic QR Codes
{% set promoLink = craft.tkaLink.get('black-friday') %}
{% if promoLink %}
<div class="qr-container">
<h4>Scan to open:</h4>
{# Fetch base64-encoded QR code data URI at size 250px #}
<img src="{{ promoLink.getQrCodeDataUri(250) }}" alt="QR Code for {{ promoLink.title }}" />
</div>
{% endif %}
π‘οΈ License
This plugin is licensed under a Proprietary License. See LICENSE.md for details.
Developed with β₯ by thekitchen.agency.
Craft-Link-Library
Standard
Plus $5/year after one year.
To install this plugin, copy the command above to your terminal.
This plugin doesn't have any reviews.