Using URL instead of PublishingLinksURL in Content Query Web Part

I wanted to use the URL field in a content query web part in SharePoint 2010, so I added the URL field to the field mapping as the image below shows:

CQWP Tool Pane

Instead of getting the standard team site URL field, the web part used the publishing URL field. How can that be?  See the table below  for the key specs on these two very different columns.

Field Internal Name GUID Field Caption
URL c29e077d-f466-4d8e-8bbe-72b66c5f205c URL
PublishedLinksUrl 70b38565-a310-4546-84a7-709cfdc140cf URL

Apparently, when you add the URL field to the web part, it uses caption, not the internal field name. The web part inserts this information into the DataMappings and DataMappingViewFields in the Content Query Web Part definition file, respectively, as shown below:


To fix this, you have to crack open the web part using either SharePoint Designer 2010 or your favorite text editor of choice. Replace the references to the PublishedLinksURL with the appropriate references to the URL field, as shown below:


Since the Content Query Web Part is part of the publishing features, it makes sense that it would default to the publishing URL field. But it’s still annoying.