Lookup to Contract object on Opportunity is showing empty value

I have a lookup field on opportunity to contract object. Contract object does not use normal Name field for lookup. I am trying to get ContractNumber which is Auto Number from contract to opportunity. IT works fine on salesforce but on skuid it does not show any value. Strange when go click this field there is an ID there but it does not show unless I click on this field. Since it is a lookup field I want the contractnumber in link format so that if I click on it, it should go to that contract. 

Any help appreciated. 

Can you provide the XML for the page?

Thank you for looking into this. Appreciate it.
The xml where I used the default:
First XML where Name is used:

Second XML where ContractNumber is used:

<field id="Main_Contract__c" overridemetadata="false" ogdisplaytype="REFERENCE" displaytype="REFERENCE" datasource="salesforce" defaultvaluetype="fieldvalue">
            <field id="Main_Contract__r.ContractNumber"></field>  

In both situation the page appears as blank value

When I click on the field then it appears that there is a value in it. But it id of that contract. What I want is the url link also with the contractNumber.

XML for the whole page.

Here is a new page I constructed that is showing the same issue:

The screen shot is: You can see there is nothing in Main Contract. If I click on it,
it does show the id of the contract. But what I need is a url link as Parent Opportunity is showing

Here you go. Display and Search Template on the field corrects the issue.

Thanks a lot. This is awesome. Really appreciate it. I wish you could also explain why I had to use {{ContractNumber}} in Display and Search Template. Why it did not happen automatically. Does that mean, the objects where the lookup is not related with Name, I would have to do  the same?. 

All lookups by default use the Name field by default on the referenced object without actually showing it Display and Search Template. Doing what we did overrode that.