Hey @kevin,
This plugin by our helpful community member @ColinDorr might be just the ticket! Showcase: Better Linking - Plugin
I don’t think we can add this to our native “Link” field functionality because that would break the backward compatibility of the data type.
Right now it’s just an record ID (or an array of them), like ‘abcdefg123’, etc. If suddenly it became an external URL like ‘https://www.example.com’, that would break any existing frontends that depend on the old ID-only behavior.
So the way to get around that is to use a more verbose field type, like a JSON field, which is exactly what ColinDorr’s plugin does, e.g.:
"betterlink": {
"linkType": {
"label": "Record",
"value": "record"
},
"record": {
"id": "181054613",
"title": "Maximizing User Retention: Effective UX Design",
[...]
},
Or for a URL, it returns:
{
"betterlink": {
"linkType": {
"label": "URL",
"value": "url"
},
"record": {},
"asset": {},
"url": {
"title": "URL",
"url": "https://www.example.com"
},
"tel": {},
"email": {},
"formatted": {
"isValid": true,
"type": "url",
"text": "https://www.example.com",
"ariaLabel": "https://www.example.com",
"url": "https://www.example.com",
"target": "_self",
"class": null
},
"open_in_new_window": false,
"isValid": true
}
},
That way your frontend can determine what kind of link it is and not have to guess based on the content.