diff --git a/lib/tasks/search.rake b/lib/tasks/search.rake
index 50ef275c3ec4dea13bcb10031c1eaf43bd786226..9a933b376d877aadac1b8922094f27c9d84da7bd 100644
--- a/lib/tasks/search.rake
+++ b/lib/tasks/search.rake
@@ -14,8 +14,8 @@ namespace :search do
 {
   {% for page in site.html_pages %}{% if page.search_exclude != true %}"{{ forloop.index0 }}": {
     "id": "{{ forloop.index0 }}",
-    "title": "{{ page.title | replace: '&', '&' }}",
-    "content": "'+content+'",
+    "title": "{{ page.title | replace: \'&\', \'&\' }}",
+    "content": "\'+content+\'",
     "url": "{{ page.url | absolute_url }}",
     "relUrl": "{{ page.url }}"
   }{% unless forloop.last %},{% endunless %}