4

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.

4 Answers 4

5

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...

3
  • Great summary of the technical and functional considerations. It's true the answer depends on how much we go into the requirements. Commented Apr 9, 2012 at 18:59
  • I'm seeing the benefits of using a component per link more and more. With that setup we can template link output (RenderComponentPresentation()), reduce typos in link urls, add metadata or other fields per link, simplify the linking schemas, and even separate permissions between who can choose to link and who determines the details of each link. For link propagation, I'd imagine we'd either instruct authors or possibly use a custom resolver? Commented Sep 18, 2012 at 0:27
  • I'm answering my own link propagation question. With links as components I would recommend instructing authors to avoid publishing the links themselves unless they really want to publish anywhere those links appear. A custom resolver might help, but it could also remove the useful ability to publish a single item. Commented Mar 23, 2014 at 4:35
4

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.

3
  • We actually brought up the external component idea when looking at ways of adding metadata to individual links. This has a great side-effect of allowing a "where used" (Tridion's find feature) on those components. Commented Apr 6, 2012 at 13:19
  • Also, I wonder then if you'd want to handle all external links with these "external link" components, even from RTF. Template code would need to assemble them into hyperlinks, but you get some nice options for transforming and mass updates. Commented Apr 6, 2012 at 13:21
  • That is a good point, if they would want to use the approach in all external links. It does make sense that they would want to standarise the process, but it does indeed need some development plus they would lose the nice options. I think only customers who have a strict policy when it comes to external links use will be happy to go for this approach. Commented Apr 11, 2012 at 12:31
3

XML Name Description Field Type

[text] Text Text

[title] Title Text

[static_url] External URL Text

[component] Internal URL Component Link

In the field description for "External URL" and "Internal URL" you could add a comment to make sure that the editor doesn't get confused, only one of these two fields should be filled in. From the component, its ID can be used to create the dynamic link in the DWT. This solution has no development effort and for the editor is pretty much as intuitive as it can get. Of course this would be a multivalue embedded schema field inside the Links schema.

1
  • Good point on adding a comment, I realize the lacking schema field description was my biggest issue with this straight forward setup. Commented Apr 6, 2012 at 13:17
2

This use-case might work using a Custom URL field and maybe a GUI extension. The idea is to have a Custom URL that opens a popup (which might be a GUI extension). In that popup, you would select/construct your link (maybe using the same options as a normal RTF link - Component, Anchor, mailto, etc).

The popup would return a specially crafted string. The format could be anything, even an actual anchor tag (but JSon is also fine). Example: {href:'tcm:1-2',type='component'}.

Your Templates would interpret this string in order to generate something meaningful, like a dynamic link or static HTML anchor.

Also the Custom URL popup should be smart enough to 'decode' such a link (if a value was specified in that field previously) and maybe pre-populate some attributes in the RTF link constructor form.

1
  • The specific organization I was working with did choose a GUI extension for some other fields for analytics and client-side personalization. We did add a functional requirement for "decoding" (or at least stripping) such tags. Not sure what their final choice was for links, but they were leaning towards RTF. Commented Sep 18, 2012 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.