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

401 Views Asked by At

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?

2

There are 2 best solutions below

1
On BEST ANSWER

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>
0
On

How do you get the value for the URL? As far as I know, the value of hyperlink column should have a Description property and a Url property. You could just use the url property to get the direct URL.