How to display links (internal an external) inside a page using a repeater?

Harold Rodriguez asked on March 27, 2014 18:06

Hi guys,

I need to create a content page template that will allow content admins to add as many links as they need inside a page, links can be internal or to external sites.

I've used Related documents so they can select internal documents, and i'm displaying them with a repeater, all good so far.

My question is, how do I have the same functionality but to create links to external sites? I thought of creating a custom table so they can add a text and link, and then have the content admin select them from a list of checkboxes but as the number of items in the custom table items grow so it will be the difficulty to find the one they are after.

Hope that makes sense.

Thanks. Harold

Recent Answers


Zdeněk Cetkovský answered on May 24, 2014 09:19

Hi Harold,

Have you already found some feasible way to achieve your aim?

I guess for links to external sites, the custom table is not bad idea, but you probably need to have them categorized, or bound to some containers, so that the content admins could filter them or see just some relevant (appropriate) subsets of all the links...

Please feel free to contact us if you have any additional questions.

Regards,

Zdenek

0 votesVote for this answer Mark as a Correct answer

Pedro Costa answered on August 31, 2014 01:01

Hi,

Have got a similar need, my requirements state that we need to mix links to files, internal and external urls in a list.

I'm going for the custom type approach, e.g. ExternalLink with a field for the external Url, that you would add under any node type.

The repeater will use a "dynamic" transformation, e.g. {%ClassName%}.HyperLinkFormat, for each supported type to use the correct fields for the tag.

Additionally I'm also going to create a web part for the redirection, e.g. ExternalLinkRedirect, to include in the master page that will only redirect if the document type is ExternalLink.

Think this covers it, and hope it can help you, but it would be great if this could be included in Kentico at some point working similar to the "Link an existing page" feature.

Cheers, P.

0 votesVote for this answer Mark as a Correct answer

Zdeněk Cetkovský answered on December 6, 2014 11:49

Hi,

Thank you, Pedro, for outlining what's currently the most effective solution for this kind of requirement. The options haven't changed since your post, although having it included as built-in feature similar to internal pages linking is an interesting idea. I have informed our Content Management PO and if we collect enough requests for similar functionality, we may consider implementing it in future versions. However, the customized solutions such as yours will be always a suitable way.

Cheers,

Zdenek

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.