JS error fix (bug 854943)

Don't generate a template for something that's only on pages with
search when you're not on a page with search.

cc @robhudson