Search code examples
htmlhandlebars.jssharepoint-onlinespfxcontent-query-web-part

SPFX Content Query [Handlebars] Unable to get a valid URL from list Hyperlink column


I am using the Content Query webpart for sharepoint online and try to query a hyperlink column from a list. I am query my "URL" column for the bing address.

<div class="url"><a href="{{URL.htmlValue}}">{{URL.htmlValue}}</a></div>

But this returns

https://sharepoint-tenant/sites/%3Ca%20href=%22http://bing.com%22%3EBING%3C/a%3E

How can I just get the direct URL?


Solution

  • Not sure I understand your problem correctly, but if you already have URL encoded, you can use triple quotes to avoid double-encoding with handlebars:

    <div class="url"><a href="{{{URL.htmlValue}}}">{{{URL.htmlValue}}}</a></div>