all things Sitecore related

Sitecore: Creating Fieldtype External link only

By on March 22, 2012 in FieldTypes, Sitecore with 2 Comments

During an Sitecore .Net development training I was ask if there is a fieldtype for an external link. The answer (of course) is; “Yes, general link”. With general link you can create a external link and many other types of links.  But what if you want to create a field in which the business users can only add an external link? You can easily create this with Sitecore (without any coding).

 

Create the External Link only Fieldtype

Fieldtypes are defined in the Core database. Switch to the core database and open the content editor and duplicate the /sitecore/system/Field types/Link Types/General Link item and call the item External Link.

Remove the unused link options

Underneath the newly created External Link item there is a folder called menu. Remove all items in the Menu folder except External Link, Clear and Follow.

 

Sitecore: Creating Fieldtype External link only external link fieldtype

Test the External Link Fieldtype

Switch back to the Master database and add a External Link field the to a template. Open an Item based on the template and you will see the newly created External Link field.

 

Sitecore: Creating Fieldtype External link only external link fieldtype result
That’s it, we have created a new Fieldtype that only accepts External links.

Tags: , , ,

About the Author

About the Author: Pieter is Technical Marketing Manager for Sitecore Netherlands and owner of Gaatverweg.nl. He has more than ten years experience with software developing in multiple programming languages and with different Content Management Systems. Before joining Sitecore Pieter was a lead developer for multiple Sitecore and .Net projects, he joined Sitecore in 2011 as an Solution Architect in The Netherlands, after two years as an Solution Architect he joined the Technical Marketing department. In the role as Techinical Marketing Manager he is responsible for the Global MVP program and the Sitecore technical branding strategy. You can follow Pieter on twitter: @pieterbrink123 or Google+ .

Subscribe

If you enjoyed this article, subscribe now to receive more just like it.

There Are 2 Brilliant Comments

Trackback URL | Comments RSS Feed

  1. John West says:

    Nice explanation Pieter! But don’t you also need to update the renderField pipeline to handle this type of field (basically, duplicate the code in the GetLinkFieldValue processor and change the field type name…hmm, maybe these processors should accept an optional list of type names using the configuration factory)? But since this specific field type never stores an internal link, you don’t have to update /App_Config/FieldTypes.config to enable link tracking for this new field type.

    • pieter says:

      John, thanks for your comment. This blog post is based on series of posts I intended to write. In that blogpost series I’m going to add an external DMS tracked link fieldtype based on the general link. So you can choose if you want to track instead of tracking all links:
      Measure Outgoing Links with DMS

      I´m still trying to finish the POC and documenting my steps, but in the meanwhile wrote this small post. Let me check the steps again, I thought it worked.

      To be continued….

Post a Comment

Your email address will not be published. Required fields are marked *

Top