Skip to content

Commit 1ae1560

Browse files
committed
feat: refactor DocSearch configuration to remove searchParameters and enhance URL handling
1 parent 64183fc commit 1ae1560

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/frontend/config/docsearch.config.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ export default {
77
apiKey: '9d632dcd5f26ef42a4818fb0d536326b',
88
indexName: 'Aspire docs',
99
insights: true,
10-
searchParameters: {
11-
// Exclude API reference pages — these have dedicated search on their own pages.
12-
// Requires 'url' to be in attributesForFaceting in the Algolia index settings.
13-
filters: 'NOT url_without_anchor_path:/reference/api/',
10+
transformItems(items) {
11+
return items.map((item) => {
12+
// Rewrite aspire.dev URLs to current host when running locally
13+
if (typeof location !== 'undefined' && location.hostname === 'localhost') {
14+
const url = new URL(item.url);
15+
url.protocol = location.protocol;
16+
url.host = location.host;
17+
return { ...item, url: url.href };
18+
}
19+
return item;
20+
});
1421
},
1522
resultsFooterComponent() {
1623
return createElement(

0 commit comments

Comments
 (0)