Skip to content

web search done right

only perform server side search when ssr parameter is set, otherwise search client side we now redirect clients with js disabled using a <noscript><meta ...</noscript> tag. this setup allows us to show an empty serp before the search is finished if one has enabled js. it also makes it posible to add more customization options later like applying optics directly from the search string. otherwise, the server would have no way of knowing what the optic rules for a particular optic name is.

Mikkel Denker065063861ddb
diff --git a/frontend/src/lib/components/Searchbar.svelte b/frontend/src/lib/components/Searchbar.svelte
index 90908ebe..422d8a44 100644
--- a/frontend/src/lib/components/Searchbar.svelte
+++ b/frontend/src/lib/components/Searchbar.svelte
@@ -172,4 +172,7 @@
</div>
{/if}
</label>
+ <noscript>
+ <input type="hidden" value="true" name="ssr" />
+ </noscript>
</form>
diff --git a/frontend/src/lib/search.ts b/frontend/src/lib/search.ts
index 02841c37..f5db4815 100644
--- a/frontend/src/lib/search.ts
+++ b/frontend/src/lib/search.ts
@@ -1,12 +1,15 @@
-import type {
- Region,
- Widget,
- DisplayedSidebar,
- DisplayedWebpage,
- WebsitesResult,
- BangHit,
- HighlightedSpellCorrection,
+import {
+ type Region,
+ type Widget,
+ type DisplayedSidebar,
+ type DisplayedWebpage,
+ type WebsitesResult,
+ type BangHit,
+ type HighlightedSpellCorrection,
+ type ApiOptions,
+ api,
} from './api';
+import { fetchRemoteOptic } from './optics';
import { decompressRanked, type RankedSites } from './rankings';
export type SearchParams = {
@@ -55,7 +58,7 @@ export const extractSearchParams = (searchParams: URLSearchParams | FormData): S
};
};
-export const discussionsOptic: string = `DiscardNonMatching;
+const discussionsOptic: string = `DiscardNonMatching;
Rule {
Matches {
@@ -93,3 +96,80 @@ Rule {
Site("|sh.itjust.works|")
}
};`;
+
+export const search = async (params: SearchParams, options: ApiOptions) => {
+ const { data: websitesReq } = api.search(
+ {
+ query: params.query,
+ page: params.currentPage - 1,
+ safeSearch: params.safeSearch,
+ optic: params.optic && (await fetchRemoteOptic({ opticUrl: params.optic, fetch })),
+ selectedRegion: params.selectedRegion,
+ hostRankings: params.host_rankings,
+ countResults: true,
+ },
+ options,
+ );
+
+ const { data: widgetReq } =
+ params.currentPage == 1
+ ? api.searchWidget(
+ {
+ query: params.query,
+ },
+ options,
+ )
+ : { data: undefined };
+
+ const { data: sidebarReq } =
+ params.currentPage == 1
+ ? api.searchSidebar(
+ {
+ query: params.query,
+ },
+ options,
+ )
+ : { data: undefined };
+
+ const { data: discussionsReq } =
+ params.currentPage == 1 && params.optic == undefined
+ ? api.search(
+ {
+ query: params.query,
+ optic: discussionsOptic,
+ numResults: 10,
+ safeSearch: params.safeSearch,
+ selectedRegion: params.selectedRegion,
+ hostRankings: params.host_rankings,
+ countResults: false,
+ },
+ options,
+ )
+ : { data: undefined };
+
+ const { data: spellcheckReq } = api.searchSpellcheck({ query: params.query }, options);
+
+ const [websites, widget, sidebar, discussionsRes, spellCorrection] = await Promise.all([
+ websitesReq,
+ widgetReq,
+ sidebarReq,
+ discussionsReq,
+ spellcheckReq,
+ ]);
+ const discussions = discussionsRes?.type == 'websites' ? discussionsRes.webpages : undefined;
+
+ const results: SearchResults =
+ websites.type == 'websites'
+ ? {
+ ...websites,
+ widget,
+ sidebar,
+ discussions,
+ spellCorrection,
+ }
+ : {
+ ...websites,
+ };
+
+ return results;
+};
diff --git a/frontend/src/routes/search/+page.server.ts b/frontend/src/routes/search/+page.server.ts
index 85f6e82a..8b4d3abc 100644
--- a/frontend/src/routes/search/+page.server.ts
+++ b/frontend/src/routes/search/+page.server.ts
@@ -1,113 +1,11 @@
-import {
- discussionsOptic,
- extractSearchParams,
- type SearchParams,
- type SearchResults,
-} from '$lib/search';
-import { redirect } from '@sveltejs/kit';
+import { extractSearchParams, type SearchParams } from '$lib/search';
import type { Actions, PageServerLoadEvent } from './$types';
-import { api } from '$lib/api';
-import { fetchRemoteOptic } from '$lib/optics';
-export const load = async ({ locals, fetch, url, getClientAddress }: PageServerLoadEvent) => {
+export const load = async ({ locals, getClientAddress }: PageServerLoadEvent) => {
const searchParams: SearchParams | undefined =
(locals['form'] && extractSearchParams(locals['form'])) || undefined;
- let params = extractSearchParams(url.searchParams);
-
- if (!params.query.trim()) {
- const form = searchParams;
- if (form) {
- params = form;
- } else {
- redirect(301, '/');
- }
- }
-
- if (!params.query.trim()) {
- redirect(301, '/');
- }
-
- const start = Date.now();
-
- const { data: websitesReq } = api.search(
- {
- query: params.query,
- page: params.currentPage - 1,
- safeSearch: params.safeSearch,
- optic: params.optic && (await fetchRemoteOptic({ opticUrl: params.optic, fetch })),
- selectedRegion: params.selectedRegion,
- hostRankings: params.host_rankings,
- countResults: true,
- },
- { fetch, headers: { 'X-Forwarded-For': getClientAddress() } },
- );
-
- const { data: widgetReq } =
- params.currentPage == 1
- ? api.searchWidget(
- {
- query: params.query,
- },
- { fetch, headers: { 'X-Forwarded-For': getClientAddress() } },
- )
- : { data: undefined };
-
- const { data: sidebarReq } =
- params.currentPage == 1
- ? api.searchSidebar(
- {
- query: params.query,
- },
- { fetch, headers: { 'X-Forwarded-For': getClientAddress() } },
- )
- : { data: undefined };
-
- const { data: discussionsReq } =
- params.currentPage == 1 && params.optic == undefined
- ? api.search(
- {
- query: params.query,
- optic: discussionsOptic,
- numResults: 10,
- safeSearch: params.safeSearch,
- selectedRegion: params.selectedRegion,
- hostRankings: params.host_rankings,
- countResults: false,
- },
- { fetch, headers: { 'X-Forwarded-For': getClientAddress() } },
- )
- : { data: undefined };
-
- const { data: spellcheckReq } = api.searchSpellcheck({ query: params.query });
-
- const [websites, widget, sidebar, discussionsRes, spellCorrection] = await Promise.all([
- websitesReq,
- widgetReq,
- sidebarReq,
- discussionsReq,
- spellcheckReq,
- ]);
- const discussions = discussionsRes?.type == 'websites' ? discussionsRes.webpages : undefined;
-
- const results: SearchResults =
- websites.type == 'websites'
- ? {
- ...websites,
- widget,
- sidebar,
- discussions,
- spellCorrection,
- }
- : {
- ...websites,
- };
-
- if (results.type == 'websites') {
- results.searchDurationMs = Date.now() - start;
- }
-
- return { form: searchParams, results };
+ return { form: searchParams, clientAddress: getClientAddress() };
};
export const actions: Actions = {
diff --git a/frontend/src/routes/search/+page.svelte b/frontend/src/routes/search/+page.svelte
index bd7e9a8f..6e9e6d46 100644
--- a/frontend/src/routes/search/+page.svelte
+++ b/frontend/src/routes/search/+page.svelte
@@ -1,173 +1,129 @@
<script lang="ts">
- import ChevronLeft from '~icons/heroicons/chevron-left-20-solid';
- import ChevronRight from '~icons/heroicons/chevron-right-20-solid';
import OpticSelector from '$lib/components/OpticSelector.svelte';
import Searchbar from '$lib/components/Searchbar.svelte';
import type { PageData } from './$types';
import RegionSelect from '$lib/components/RegionSelect.svelte';
- import type { DisplayedWebpage } from '$lib/api';
- import { onMount } from 'svelte';
import { searchQueryStore } from '$lib/stores';
- import { flip } from 'svelte/animate';
- import Result from './Result.svelte';
- import Sidebar from './Sidebar.svelte';
- import Widget from './Widget.svelte';
- import Discussions from './Discussions.svelte';
import { page } from '$app/stores';
import { updateQueryId } from '$lib/improvements';
import { browser } from '$app/environment';
- import Modal from './Modal.svelte';
+ import Serp from './Serp.svelte';
+ import { search } from '$lib/search';
export let data: PageData;
$: results = data.results;
- $: query = data.query;
+ $: query = data.params.query;
- let modal: { top: number; left: number; site: DisplayedWebpage } | undefined;
+ let prevPageSearchParams: URLSearchParams | null = null;
+ let nextPageSearchParams: URLSearchParams | null = null;
- onMount(() => {
- const listener = () => {
- modal = void 0;
- };
- document.addEventListener('click', listener);
- return () => document.removeEventListener('click', listener);
- });
+ $: {
+ if (data.params.currentPage > 1) {
+ const newParams = new URLSearchParams($page.url.searchParams);
+ newParams.set('p', (data.params.currentPage - 1).toString());
+ prevPageSearchParams = newParams;
+ } else {
+ prevPageSearchParams = null;
+ }
- const openSearchModal =
- (site: DisplayedWebpage) =>
- ({ detail: button }: CustomEvent<HTMLButtonElement>) => {
- const rect = button.getBoundingClientRect();
+ if (results && results.type == 'websites' && results.hasMoreResults) {
+ const newParams = new URLSearchParams($page.url.searchParams);
+ newParams.set('p', (data.params.currentPage + 1).toString());
+ nextPageSearchParams = newParams;
+ } else {
+ nextPageSearchParams = null;
+ }
+ }
- if (modal?.site == site) {
- modal = void 0;
- return;
- }
+ const clientSearch = async () => {
+ if (!browser) return;
- // NOTE: The point calculated is the middle of the right edge of the clicked
- // element, like so:
- // +---+
- // | x <--
- // +---+
- modal = {
- top: window.scrollY + rect.top + rect.height / 2,
- left: window.scrollX + rect.right,
- site,
- };
- };
+ const res = await search(data.params, { fetch: fetch });
- // NOTE: save the search query to be used in the header
- $: searchQueryStore?.set($page.url.search);
+ if (res.type == 'bang') {
+ window.location.replace(res.redirectTo);
+ return null;
+ }
- $: {
- results;
- modal = void 0;
- }
+ results = res;
+
+ return res;
+ };
+
+ // NOTE: save the search query to be used in the navbar
+ $: searchQueryStore?.set($page.url.search);
+ let paramsForRedirect = new URLSearchParams($page.url.search);
+ let serverSearch = paramsForRedirect.get('ssr') === 'true';
+ paramsForRedirect.set('ssr', 'true');
+ let encodedQueryForRedirect = paramsForRedirect.toString();
$: {
- if (browser && results.type == 'websites') updateQueryId({ query, webpages: results.webpages });
+ if (browser && results && results.type == 'websites')
+ updateQueryId({ query, webpages: results.webpages });
}
</script>
-{#if modal}
- <Modal {query} {modal} />
+{#if !serverSearch}
+ <noscript>
+ <meta http-equiv="refresh" content="0;url=/search?{encodedQueryForRedirect}" />
+ <div>
+ You are being redirected to <a href="/search?{encodedQueryForRedirect}" class="underline"
+ >a page that doesn't require javascript.</a
+ >
+ </div>
+ </noscript>
{/if}
-{#if results.type == 'websites'}
- <div
- class="m-0 grid w-full grid-rows-[auto_1fr] gap-y-5 px-5 pt-4 md:grid-cols-[minmax(50ch,48rem)_1fr] md:gap-x-12 md:pl-20 lg:pl-28"
- style="text-rendering:optimizeLegibility;font-smooth:always;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;"
- >
- <div class="flex max-w-2xl flex-col space-y-1">
- <div class="w-full">
- <Searchbar {query} />
- </div>
- <div class="mx-auto flex w-full justify-end sm:justify-between">
- <div class="hidden h-full flex-col space-x-2 text-xs text-neutral sm:flex">
- <p class="h-fit">
- {#if results.numHits != null}
- Found <span class="font-medium">{results.numHits.toLocaleString()}</span> results in
- <span class="font-medium">{((results.searchDurationMs ?? 0) / 1000).toFixed(2)}s</span
- >
- {:else}
- Search took <span class="font-medium"
- >{((results.searchDurationMs ?? 0) / 1000).toFixed(2)}s</span
- >
- {/if}
- </p>
- </div>
- <div class="flex space-x-2">
- <div class="m-0 flex h-full flex-col justify-center p-0">
- <OpticSelector searchOnChange={true} selected={data.optic} />
- </div>
- <div class="select-region flex h-full flex-col justify-center">
- <RegionSelect searchOnChange={true} selected={data.selectedRegion} />
- </div>
- </div>
- </div>
+<div
+ class="m-0 grid w-full grid-rows-[auto_1fr] gap-y-5 px-5 pt-4 md:grid-cols-[minmax(50ch,48rem)_1fr] md:gap-x-12 md:pl-20 lg:pl-28"
+ style="text-rendering:optimizeLegibility;font-smooth:always;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;"
+>
+ <div class="flex max-w-2xl flex-col space-y-1">
+ <div class="w-full">
+ <Searchbar {query} />
</div>
- <div class="col-start-1 flex min-w-0 max-w-2xl flex-col space-y-5">
- {#if results.spellCorrection}
- <div>
- <div>
- Did you mean:{' '}
- <a
- class="font-medium"
- href="/search?q={encodeURIComponent(results.spellCorrection.raw)}"
- >{#each results.spellCorrection.highlighted as frag}
- {#if frag.kind == 'highlighted'}
- <b><i>{frag.text}</i></b>
- {:else}
- {frag.text}
- {/if}
- {/each}</a
+ <div class="mx-auto flex w-full justify-end sm:justify-between">
+ <div class="hidden h-full flex-col space-x-2 text-xs text-neutral sm:flex">
+ <p class="h-fit">
+ {#if results && results.numHits != null}
+ Found <span class="font-medium">{results.numHits.toLocaleString()}</span> results in
+ <span class="font-medium">{((results.searchDurationMs ?? 0) / 1000).toFixed(2)}s</span>
+ {:else if results}
+ Search took <span class="font-medium"
+ >{((results.searchDurationMs ?? 0) / 1000).toFixed(2)}s</span
>
- </div>
- </div>
- {/if}
-
- {#if results.widget}
- <Widget widget={results.widget} />
- {/if}
-
- {#if results.webpages}
- <div class="grid w-full grid-cols-1 space-y-10 place-self-start">
- {#each results.webpages as webpage, resultIndex (`${query}-${webpage.url}`)}
- <div animate:flip={{ duration: 150 }}>
- <Result {webpage} {resultIndex} on:modal={openSearchModal(webpage)} />
- </div>
- {/each}
- {#if results.discussions}
- <Discussions discussions={results.discussions} />
{/if}
+ </p>
+ </div>
+ <div class="flex space-x-2">
+ <div class="m-0 flex h-full flex-col justify-center p-0">
+ <OpticSelector searchOnChange={true} selected={data.params.optic} />
</div>
- {/if}
-
- <div class="flex justify-center">
- <div class="grid grid-cols-[repeat(3,auto)] items-center justify-center gap-2">
- {#if data.prevPageSearchParams}
- <a href="/search?{data.prevPageSearchParams}">
- <ChevronLeft class="text-xl text-primary hover:text-primary-focus" />
- </a>
- {:else}
- <ChevronLeft class="text-xl text-neutral" />
- {/if}
- <div>Page {data.currentPage}</div>
- {#if data.nextPageSearchParams}
- <a href="/search?{data.nextPageSearchParams}">
- <ChevronRight class="text-xl text-primary hover:text-primary-focus" />
- </a>
- {:else}
- <ChevronRight class="text-xl text-neutral" />
- {/if}
+ <div class="select-region flex h-full flex-col justify-center">
+ <RegionSelect searchOnChange={true} selected={data.params.selectedRegion} />
</div>
</div>
</div>
-
- {#if results.sidebar}
- <div
- class="row-start-2 mx-auto max-w-[90vw] justify-center md:col-start-2 md:row-span-2 md:row-start-1 md:max-w-[30vw] md:pt-5"
- >
- <Sidebar sidebar={results.sidebar} />
- </div>
- {/if}
</div>
-{/if}
+ {#if results}
+ <Serp
+ {results}
+ {query}
+ {prevPageSearchParams}
+ {nextPageSearchParams}
+ currentPage={data.params.currentPage}
+ />
+ {:else}
+ {#await clientSearch() then results}
+ {#if results}
+ <Serp
+ {results}
+ {query}
+ {prevPageSearchParams}
+ {nextPageSearchParams}
+ currentPage={data.params.currentPage}
+ />
+ {/if}
+ {/await}
+ {/if}
+</div>
diff --git a/frontend/src/routes/search/+page.ts b/frontend/src/routes/search/+page.ts
index cc9d85f4..196c0bb6 100644
--- a/frontend/src/routes/search/+page.ts
+++ b/frontend/src/routes/search/+page.ts
@@ -1,15 +1,18 @@
import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';
-import { match } from 'ts-pattern';
-import { extractSearchParams } from '$lib/search';
+import { extractSearchParams, search, type SearchResults } from '$lib/search';
import { globals } from '$lib/globals';
+import { browser } from '$app/environment';
export const load: PageLoad = async (req) => {
- const { url } = req;
+ const { url, fetch } = req;
+ const { clientAddress, form } = req.data;
+
+ const performSsr = url.searchParams.get('ssr') === 'true';
+
let params = extractSearchParams(url.searchParams);
if (!params.query.trim()) {
- const form = req.data['form'];
if (form) {
params = form;
} else {
@@ -21,32 +24,21 @@ export const load: PageLoad = async (req) => {
redirect(301, '/');
}
- const results = req.data['results'];
+ let results: SearchResults | null = null;
- if (results.type == 'bang') {
- redirect(301, results.redirectTo);
+ if (performSsr && !browser) {
+ results = await search(params, {
+ fetch,
+ headers: { 'X-Forwarded-For': clientAddress },
+ });
}
- const prevPageSearchParams = match(params.currentPage > 1)
- .with(true, () => {
- const newParams = new URLSearchParams(url.searchParams);
- newParams.set('p', (params.currentPage - 1).toString());
- return newParams;
- })
- .otherwise(() => {});
-
- const nextPageSearchParams = match(results.type == 'websites' && results.hasMoreResults)
- .with(true, () => {
- const newParams = new URLSearchParams(url.searchParams);
- newParams.set('p', (params.currentPage + 1).toString());
- return newParams;
- })
- .otherwise(() => {});
+ if (results && results.type == 'bang') {
+ redirect(301, results.redirectTo);
+ }
return {
- ...params,
- prevPageSearchParams,
- nextPageSearchParams,
+ params,
results,
globals: await globals({
title: `${params.query} – Stract`,
diff --git a/frontend/src/routes/search/Result.svelte b/frontend/src/routes/search/Result.svelte
index baf9d219..f1a47f16 100644
--- a/frontend/src/routes/search/Result.svelte
+++ b/frontend/src/routes/search/Result.svelte
@@ -24,12 +24,12 @@
const dispatch = createEventDispatcher<{ modal: HTMLButtonElement }>();
</script>
-<div class="flex min-w-0 grow flex-col space-y-0.5">
+<div class="result flex min-w-0 grow flex-col space-y-0.5">
<div class="flex min-w-0">
<div class="flex min-w-0 grow flex-col space-y-0.5">
<div class="flex items-center text-sm">
<ResultLink
- _class="max-w-[calc(100%-100px)] truncate text-neutral-focus"
+ _class="url max-w-[calc(100%-100px)] truncate text-neutral-focus"
href={webpage.url}
{resultIndex}
>
@@ -37,7 +37,7 @@
</ResultLink>
</div>
<ResultLink
- _class="max-w-[calc(100%-30px)] truncate text-xl font-medium text-link visited:text-link-visited hover:underline"
+ _class="title max-w-[calc(100%-30px)] truncate text-xl font-medium text-link visited:text-link-visited hover:underline"
title={webpage.title}
href={webpage.url}
{resultIndex}
diff --git a/frontend/src/routes/search/Serp.svelte b/frontend/src/routes/search/Serp.svelte
new file mode 100644
index 00000000..40f2135b
--- /dev/null
+++ b/frontend/src/routes/search/Serp.svelte
@@ -0,0 +1,128 @@
+<script lang="ts">
+ import { type DisplayedWebpage } from '$lib/api';
+ import type { SearchResults } from '$lib/search';
+ import { onMount } from 'svelte';
+
+ import Modal from './Modal.svelte';
+ import Result from './Result.svelte';
+ import Widget from './Widget.svelte';
+ import Discussions from './Discussions.svelte';
+ import Sidebar from './Sidebar.svelte';
+
+ import ChevronLeft from '~icons/heroicons/chevron-left-20-solid';
+ import ChevronRight from '~icons/heroicons/chevron-right-20-solid';
+ import { flip } from 'svelte/animate';
+
+ export let results: SearchResults;
+ export let query: string;
+ export let nextPageSearchParams: URLSearchParams | null;
+ export let prevPageSearchParams: URLSearchParams | null;
+ export let currentPage: number;
+
+ let modal: { top: number; left: number; site: DisplayedWebpage } | undefined;
+
+ onMount(() => {
+ const listener = () => {
+ modal = void 0;
+ };
+ document.addEventListener('click', listener);
+ return () => document.removeEventListener('click', listener);
+ });
+
+ const openSearchModal =
+ (site: DisplayedWebpage) =>
+ ({ detail: button }: CustomEvent<HTMLButtonElement>) => {
+ const rect = button.getBoundingClientRect();
+
+ if (modal?.site == site) {
+ modal = void 0;
+ return;
+ }
+
+ // NOTE: The point calculated is the middle of the right edge of the clicked
+ // element, like so:
+ // +---+
+ // | x <--
+ // +---+
+ modal = {
+ top: window.scrollY + rect.top + rect.height / 2,
+ left: window.scrollX + rect.right,
+ site,
+ };
+ };
+
+ $: {
+ results;
+ modal = void 0;
+ }
+</script>
+
+{#if modal}
+ <Modal {query} {modal} />
+{/if}
+
+{#if results.type == 'websites'}
+ <div class="col-start-1 flex min-w-0 max-w-2xl flex-col space-y-5">
+ {#if results.spellCorrection}
+ <div>
+ <div>
+ Did you mean:{' '}
+ <a class="font-medium" href="/search?q={encodeURIComponent(results.spellCorrection.raw)}"
+ >{#each results.spellCorrection.highlighted as frag}
+ {#if frag.kind == 'highlighted'}
+ <b><i>{frag.text}</i></b>
+ {:else}
+ {frag.text}
+ {/if}
+ {/each}</a
+ >
+ </div>
+ </div>
+ {/if}
+
+ {#if results.widget}
+ <Widget widget={results.widget} />
+ {/if}
+
+ {#if results.webpages}
+ <div class="grid w-full grid-cols-1 space-y-10 place-self-start">
+ {#each results.webpages as webpage, resultIndex (`${query}-${webpage.url}`)}
+ <div animate:flip={{ duration: 150 }}>
+ <Result {webpage} {resultIndex} on:modal={openSearchModal(webpage)} />
+ </div>
+ {/each}
+ {#if results.discussions}
+ <Discussions discussions={results.discussions} />
+ {/if}
+ </div>
+ {/if}
+
+ <div class="flex justify-center">
+ <div class="grid grid-cols-[repeat(3,auto)] items-center justify-center gap-2">
+ {#if prevPageSearchParams}
+ <a href="/search?{prevPageSearchParams}">
+ <ChevronLeft class="text-xl text-primary hover:text-primary-focus" />
+ </a>
+ {:else}
+ <ChevronLeft class="text-xl text-neutral" />
+ {/if}
+ <div>Page {currentPage}</div>
+ {#if nextPageSearchParams}
+ <a href="/search?{nextPageSearchParams}">
+ <ChevronRight class="text-xl text-primary hover:text-primary-focus" />
+ </a>
+ {:else}
+ <ChevronRight class="text-xl text-neutral" />
+ {/if}
+ </div>
+ </div>
+ </div>
+
+ {#if results.sidebar}
+ <div
+ class="row-start-2 mx-auto max-w-[90vw] justify-center md:col-start-2 md:row-span-2 md:row-start-1 md:max-w-[30vw] md:pt-5"
+ >
+ <Sidebar sidebar={results.sidebar} />
+ </div>
+ {/if}
+{/if}