From 92686a09af289c71b661734e25dabb1224395138 Mon Sep 17 00:00:00 2001 From: hasparus Date: Mon, 7 Jun 2021 19:21:40 +0200 Subject: [PATCH] docs: search results now lead to open deployment instead of always going to prod --- packages/docs/src/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/docs/src/index.js b/packages/docs/src/index.js index 84ee8e74d..a578c047b 100755 --- a/packages/docs/src/index.js +++ b/packages/docs/src/index.js @@ -41,7 +41,6 @@ export const setDocSearchComponents = ({ type="text/javascript" dangerouslySetInnerHTML={{ __html: ` - var lastSearchInput = null; var observer = new MutationObserver(function () { var searchSelector = "#algolia-docs-search"; @@ -52,7 +51,15 @@ export const setDocSearchComponents = ({ apiKey: "84ed820927eee5fa5018c9f1abe70390", indexName: "theme-ui", inputSelector: searchSelector, - debug: true + debug: true, + transformData: function(hits) { + for (const hit of hits) { + hit.url = hit.url.replace( + "https://theme-ui.com", + window.location.origin + ) + } + } }) lastSearchInput = searchInput; }