@@ -171,29 +171,22 @@ function makeTeaser(body, terms) {
171171 startIndex = word[2];
172172 }
173173
174− // add dark color around search terms
175− if (word[1] === TERM_WEIGHT) {
176− teaser.push("<span>");
177− }
178174 startIndex = word[2] + word[0].length;
179175 teaser.push(body.substring(word[2], startIndex));
180176
181− if (word[1] === TERM_WEIGHT) {
182− teaser.push("</span>");
183− }
184177 }
185178 teaser.push("…");
186179 return teaser.join("");
187180}
188181
189−function formatSearchResultTitle(path) {
190− var pathArray = path.split( '/' );
182+function formatSearchResultTitle(item) {
183+ var pathArray = item.ref.split( '/' );
191184
192185 // first directory is in 4th element of split path array
193186 var firstPartTitle = pathArray[3];
194187
195188 // last directory is in 2nd to last element of array
196− var lastPartTitle = pathArray[pathArray.length-2].replace(/-/g,' ');
189+ var lastPartTitle = item.doc.title;
197190
198191 var fullTitle = firstPartTitle + '<span class="gray90 inline-block pl2">' + ' / ' + lastPartTitle + '</span>';
199192
@@ -201,10 +194,11 @@ function formatSearchResultTitle(path) {
201194}
202195
203196function formatSearchResultItem(item, terms) {
197+ console.log(item);
204198 var li = document.createElement("li");
205199 var createA = document.createElement("a");
206200 li.appendChild(createA);
207− var teaserTitle = formatSearchResultTitle(item.ref);
201+ var teaserTitle = formatSearchResultTitle(item);
208202 li.classList.add("search-results__item");
209203 li.classList.add("ph3");
210204 var hrefA = item.ref;
@@ -297,7 +291,7 @@ function initSearch() {
297291 }
298292
299293 currentTerm = term;
300− searchResultsHeader.innerText = `${results.length} search results for '${term}':`;
294+ searchResultsHeader.innerText = `${results.length} search results for '${term}':`;
301295 for (var i = 0; i < Math.min(results.length, MAX_ITEMS); i++) {
302296 if (!results[i].doc.body) {
303297 continue;