Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDL Tridion Schema Field "List of Links" Options

Tags:

tridion

I'm looking to create an SDL Tridion schema with a list of repeatable links while avoiding multiple fields per link.

Hyperlink

In a rich text field I have the following options for creating a hyperlink:*

  • Component
  • Anchor
  • http://
  • mailto:
  • Other

When content authors create one of these hyperlinks, they have the option to select linked (visible) text as well as title and target attributes that function like typical HTML hyperlinks.

"Richtext" means a Text field with Height of the Text Area = at least 2 rows with Allow Rich Text Formatting selected.

Single Schema Field Link When creating a single schema field, I see these options:

  • External Link (author options will include http://, mailto, Other)
  • Multimedia Link
  • Component Link (which can allow Multimedia Values)

Current Ideas

The best out-of-the-box (OOTB) setups I've found for this "list of links" is either offering:

  1. a single 2-line RTF with instructions to create a hyperlink (of any type) in that field
  2. separate fields for each type as well as additional fields for display name, target, and title (where the fields are assembled through template code), authors fill in only one of the fields (component link or external)

Question

Is there a way in the schema form designer, by updating the schema source, or through code to offer the same (RTF) hyperlink drop-down options, but in a single field? I could be missing something, but recognize this scenario isn't supported OOTB.

like image 891
Alvin Reyes Avatar asked Dec 10 '22 01:12

Alvin Reyes


2 Answers

One question we are missing here is to consider if those links are going to be used somewhere else individually. If that's the case, multiple components would be my first choice, so we can reuse each component several times.

If you are planning to allow the editor to create a list of links that they are only going to use in a given component (not reusable), well, you have all the options mentioned in the previous answers.

To give you an idea on what's the best approach (in my humble opinion) here are things to consider:

  1. Individual Components per link: use this approach if links are reusable.

  2. Using embedded schemas (with the link structure) so this approach can be used in different component types (schemas)

  3. Custom URL / Single Line Text Field: it requires an additional development effort and it is very unlikely you will keep the hard-link-references when creating internal links. As you know SDL Tridion keeps a reference to the tcm id in order to resolve links, trigger publishing, etc..

  4. Custom URL / 2 Lines RTF: It will do the job, but you need to make sure you disable all the other RTF options from the Ribbon Tool Bar within the Schema RTF options, so you meke sure that the editors can only create links. Also, you might need to consider to add an XSLT filter to check if the edtiors entered something more than just links. These links are not reusable.

In general if you implement something custom (GUI extension + Custom URL) keep in mind all the TRIDION CMS concepts, like blueprinting (what happens when the link is inherited down), where used, etc...

My recommendation has always been to use Separated Components, but be careful with the link propagation when publishing...

like image 170
Jaime Santos Alcón Avatar answered Jan 24 '23 22:01

Jaime Santos Alcón


I have seen this case at customers. If they consider less development effort, the idea of having a multiple embedded field is good.

You can have it as:

[text] Link Text

[Component Link] Link to anything

You would need an extra Content schema for External Links, like:

[External Link] Url

[text] target

[any extra option you need]

This means the editor would need to create a new External Link Component every time they create an external link. It is extra work, but it can also mean easier maintenance on the use of external urls within their site.

Lastly, the editor would just add multiple Component Links, those being of schema External Link of any other. It will be the template code which checks on the schema of the linked Component and add the code accordingly.

like image 40
Mónica Manzano Avatar answered Jan 25 '23 00:01

Mónica Manzano