From 9f90f2609ff41ba2f063f5525e7cebc585f23617 Mon Sep 17 00:00:00 2001 From: Mikael Brevik Date: Tue, 28 May 2024 23:32:52 +0200 Subject: [PATCH] feat: adds using generated open graph search result --- pages/search.tsx | 25 +++++++++++++++++++++++++ src/layouts/general/index.tsx | 13 +++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/pages/search.tsx b/pages/search.tsx index a1143c71..39945715 100644 --- a/pages/search.tsx +++ b/pages/search.tsx @@ -27,6 +27,7 @@ import clear from 'public/assets/illustrations/clear.svg'; import ButtonBlob from 'src/components/buttonBlobLink'; import useDebounce from 'src/utils/use-debounce'; import Button from 'src/components/button'; +import Head from 'next/head'; const appId = process.env.NEXT_PUBLIC_ALGOLIA_APP_ID || ''; const apiKey = process.env.NEXT_PUBLIC_ALGOLIA_READ_KEY || ''; @@ -42,8 +43,32 @@ type SearchPageProps = { export default function Search(props: SearchPageProps) { const userInfo = useUserdata(); + const searchQuery = encodeURIComponent( + props.serverState?.initialResults.handbook_content.state.query ?? '', + ); + + const firstResultPotential = ( + props.serverState?.initialResults.handbook_content.results[0]?.hits[0] + ?.content ?? 'Ikke funnet' + ).substring(0, 255); + + console.log('Dsadsa\n\n\\n\n\n\n', firstResultPotential, '\n\n\\n\n\n\n'); return ( + + + + + +

Hva leter du etter?

diff --git a/src/layouts/general/index.tsx b/src/layouts/general/index.tsx index f7e6132a..36f4f539 100644 --- a/src/layouts/general/index.tsx +++ b/src/layouts/general/index.tsx @@ -221,10 +221,15 @@ export default function GeneralLayout({ - +