diff --git a/html/search.ejs b/html/search.ejs index 00e59cbf..faf52991 100644 --- a/html/search.ejs +++ b/html/search.ejs @@ -624,6 +624,17 @@ const upsellMessages = [ const showUpsell = !answer && Math.random() < 0.2; const randomUpsellMessage = showUpsell ? upsellMessages[Math.floor(Math.random() * upsellMessages.length)] : ''; + + +function extractQueryFromUpsellMessage(message) { + return message.replace("[new] Try searching '", "") + .replace("[new] Try '", "") + .replace("[new] Ask '", "") + .replace("[new] Try ", "") + .replace("'", "") + .replace("?", "") + .trim(); +} %> %> <% if (answer) { %> @@ -636,10 +647,24 @@ const randomUpsellMessage = showUpsell ? upsellMessages[Math.floor(Math.random() <% } else if (showUpsell) { %> - - <%= randomUpsellMessage %> + + + <%= randomUpsellMessage %> <% } %> + + <% const searchStrings = [ "suicide", "self harm", "self-harm", "support", "murder", "how to murder", "kill myself",