Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@ export default defineConfig({
]
: []),
starlightDocSearch({
appId: "D32WIYFTUF",
apiKey: "5cec275adc19dd3bc17617f7d9cf312a",
indexName: "prod_devdocs",
insights: true,
clientOptionsModule: "./src/plugins/docsearch/index.ts",
}),
starlightImageZoom(),
],
Expand Down
21 changes: 21 additions & 0 deletions src/plugins/docsearch/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { DocSearchClientOptions } from "@astrojs/starlight-docsearch";

export default {
appId: "D32WIYFTUF",
apiKey: "5cec275adc19dd3bc17617f7d9cf312a",
indexName: "prod_devdocs",
insights: true,
// Replace URL with the current origin so search
// can be used in local development and previews.
transformItems(items) {
return items.map((item) => {
const path = new URL(item.url).pathname;
const url = new URL(path, window.origin);

return {
...item,
url: url.toString(),
};
});
},
} satisfies DocSearchClientOptions;