I am editing an Item Display Template (for a content search web part) on SP2016 enterprise.
In the display template (Item_LargePicture.html), I inserted a JavaScript function to randomly return a image tag (e.g. <img src="/sites/os/PublishingImages/thumbs/01.jpg" alt=""> ). The function named getImageTag().
In the main html part of template I call my JS function like below syntax:
<span style="display: table-cell;width: 50%">
<article id="_#= containerId =#_" data-displaytemplate="ItemLargePicture">
<a class="image fit thumb" href="_#= linkURL =#_" title="_#= $htmlEncode(line1) =#_" id="_#= pictureLinkId =#_">
<!--#_
document.write(getImageTag());
_#-->
</a>
<span class="text-block" id="_#= dataContainerId =#_">
<a href="_#= linkURL =#_" title="_#= $htmlEncode(line1) =#_" id="_#= line1LinkId =#_">
<h3 id="_#= line1Id =#_"> _#= line1 =#_</h3>
</a>
</span>
</article></span>
When I load the SharePoint page with display template, all I got is Display Error: The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.
I cannot debug with above error. Could you advise the correct syntax?