The sc:link field provided by Sitecore in conjunction with the ‘General Link’ field type is a really flexible combination. When setting a field type in a template as ‘General Link’, it gives a variety of options for links that can be inserted in that field:
When editing an item through the content editor, clicking on each different type of link will open a different window, with the appropriate fields to enter information:
However, there is no option to set the link type in the control when placing it in the sublayout – so users that edit the item in page editor always see the first type (which is ‘internal’) or if the item was already edited via the content editor, they will see the type of link that was set by the user when they created/updated it.
I thought this was odd behavior and researched a little bit to find that the foundation of the field was still the xsl link field – which did have a linktype. A little more research led me to find that you can set it to a certain type for the users that use page editor, by putting in the definition in the raw values option.
So, to do this, you will need to create a standard values for the template. Once you do that, go to View and check ‘Raw Values’. Once checked, go into the field in your template, and put the following text:
<link linktype="external" url="" anchor="" target="" />
Now, when you go into page editor, and you click on ‘edit link’ icon, it will open the type that you set. The different link types are:
Each of these have different attributes as well – the example above shows the values for when the linktype is ‘external’, which has options for url, anchor and target.
Here are the attributes available for all the types:
This still only gives you the option in the page editor to have only one type of link. This is OK for most situations, I would imagine, and the types can always be changed in the content editor. If you know of a way to achieve this in the page editor using the command buttons, drop me a note!