Skip to content

Commit

Permalink
Simplify search config
Browse files Browse the repository at this point in the history
  • Loading branch information
forgetso committed Feb 25, 2025
1 parent a52917d commit eed5d9a
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/components/starlight/Search.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,40 +27,12 @@ const docSearchStrings = getDocSearchStrings(Astro);
<script>
import docsearch from '@docsearch/js';

// @ts-expect-error todo: add proper type casting
const translations = JSON.parse(document.querySelector('sl-doc-search').dataset.translations);

docsearch({
container: 'sl-doc-search',
appId: 'OCM8ZFZOLH',
indexName: 'prosopo_docs_pages',
apiKey: '6945155a60a9005eb656b393296bc9a3',
//searchParameters: { facetFilters: [[`lang:${location.pathname.split('/')[1]}`]] },
insights: true,
getMissingResultsUrl: ({ query }: { query: string }) =>
`https://github.com/prosopo/docs/issues/new?title=Missing+results+for+query+%22${encodeURIComponent(
query
)}%22`,
transformItems: (items) => {
return items.map((item) => {
// We transform the absolute URL into a relative URL to
// work better on localhost, preview URLS.
const url = new URL(item.url);
if (url.hash === '#_top') url.hash = '';
return {
...item,
url: url.href.replace(url.origin, ''),
};
});
},
placeholder: translations.placeholder,
translations: {
...translations,
button: {
buttonText: translations.button,
buttonAriaLabel: translations.button,
},
},
sitemaps: [
{
url: new URL('https://docs.prosopo.io/sitemap-0.xml').href,
Expand Down

0 comments on commit eed5d9a

Please sign in to comment.