Watch out when you move display templates from Office 365 to On-premises
This post is over a year old, some of this information may be out of date.
Today I was creating my session for SharePoint Saturday Belgium and Paris. For my demo’s I prepared a couple of display templates that were created on Office 365 / SharePoint Online. To be sure that I had a backup plan, I moved all these display templates to my development environment on-premises.
The first thing I got after I configured the web parts were errors like this:

As it turns out, the $urlHtmlEncodeString function does only exist for SharePoint Online at the moment.
Available on Office 365: $ urlHtmlEncode, $urlHtmlEncodeString, $urlHtmlEncodeValueObject
Available on On-premises: $urlHtmlEncode
It could be that there are other functions which you cannot use on-premises. Feel free to provide me feedback if you experienced something similar.
Related articles
Creating Custom Refiner Control Display Templates for SharePoint 2013
Part 1: Create Your First Search Refiner Control Template
Part 2: Adding Refinement Actions to the Custom Search Refiner Control
Report issues or make changes on GitHub
Found a typo or issue in this article? Visit the GitHub repository to make changes or submit a bug report.
Comments
Let's build together
Manage content in VS Code
Present from VS Code