7
votes

How would I go about adding a field type that would contain a list of links? These links need to be able to be internal, media or external.

I have a Quick Links template being inherited by multiple templates on my site. Until now I have been using a Treelist with the Datasource limiting to specific templates to populate a repeater to output a list of links in the sub navigation of the page. This has been working well for internal links but now I need to extend this to be able to handle links to items in the media library and/or external links. Its the external links that are causing my confusion as they don't exist as items within Sitecore so I'm unsure how best to be linked. I would prefer not to have to create new items for each external link as this seems inefficient.

I was thinking I could potentially use a custom field type, similar functionality as a Name Value List but be able to have a list of General Link's?

Any help to point me in the right direction would be much appreciated.

2

2 Answers

4
votes

I recently developed a similar solution with a link list field type. The field stores XML-data for the links defined, using Sitecore link tools for internal, external and media links, though still lacking some features.

I have been considering to release it as part of the Shared Source library but the code need some refactoring first... If you are interested, I could send you the version I'm currently working on before releasing it as Shared Source...?

4
votes

Sitecore has a Shared Source repository available to registered users of the Sitecore Developer Network (referenced in @andreasordell's post). One of the modules in this directory, Inline Item List Field, creates a multilist field with the ability to add, edit, and delete items directly from the parent item.

With this field, it becomes much more efficient to create new items for each link. Content editors can directly modify the list without knowing where the items are stored in the hierarchy and the same list of items can be re-used. Furthermore, you can restrict contents of the list items to a single general link field or many fields based on your requirements.