@fresh.codes/strapi-plugin-link-field
v1.0.0
Published
A custom field that provides link details to a resource, a file, or a plain text url.
Readme
Strapi Plugin Link Field
A custom field for Strapi that provides link functionality, supporting URLs, file uploads, and content relations.

Installation
npm install @fresh.codes/strapi-plugin-link-fieldConfiguration
Configure content relations and URL templates:
// config/plugins.js
module.exports = {
'link-field': {
enabled: true,
config: {
relations: {
'api::article.article': {
urlTemplate: '/articles/{slug}',
},
'api::page.page': {
urlTemplate: '/pages/{slug}',
},
'api::product.product': {
urlTemplate: '/products/{id}',
},
},
},
},
}Template variables are replaced with actual values from the related content:
{id}→ Content ID{slug}→ Content slug{title}→ Content title- Any other field name from the content
Data Structure
The link field stores data in the following format:
type LinkFieldData = {
text?: string // Display text for the link
linkType: 'url' | 'file' | UID.ContentType // Type of link (url, file, or relation key)
relatedData?: {
// Related content data or file
id: number
url?: string
title?: string
name?: string
slug?: string
[key: string]: unknown
}
openInNewTab?: boolean // Whether to open in new tab
url?: string
}License
Made by Fresh Codes.
