Skip to content
Open
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
3 changes: 3 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
onlyBuiltDependencies:
- esbuild
- sharp
5 changes: 4 additions & 1 deletion src/frontend/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import starlightScrollToTop from 'starlight-scroll-to-top';
import starlightSidebarTopics from 'starlight-sidebar-topics';
import starlightPageActions from 'starlight-page-actions';
import jopSoftwarecookieconsent from '@jop-software/astro-cookieconsent';
import starlightDocSearch from '@astrojs/starlight-docsearch';

// https://astro.build/config
export default defineConfig({
Expand Down Expand Up @@ -58,7 +59,6 @@ export default defineConfig({
Hero: './src/components/starlight/Hero.astro',
MarkdownContent: './src/components/starlight/MarkdownContent.astro',
PageTitle: './src/components/starlight/PageTitle.astro',
Search: './src/components/starlight/Search.astro',
Sidebar: './src/components/starlight/Sidebar.astro',
SocialIcons: './src/components/starlight/SocialIcons.astro',
},
Expand All @@ -69,6 +69,9 @@ export default defineConfig({
styleOverrides: { borderRadius: '0.5rem', codeFontSize: '1rem' },
},
plugins: [
starlightDocSearch({
clientOptionsModule: './config/docsearch.config.ts',
}),
starlightPageActions({
share: true,
actions: {
Expand Down
37 changes: 37 additions & 0 deletions src/frontend/config/docsearch.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { DocSearchClientOptions } from '@astrojs/starlight-docsearch';
import { createElement } from 'preact';

// Both appId and apiKey are considered public info.
export default {
appId: 'CDBTET76S0',
apiKey: '9d632dcd5f26ef42a4818fb0d536326b',
indexName: 'Aspire docs',
insights: true,
transformItems(items) {
return items.map((item) => {
// Rewrite aspire.dev URLs to current host when running locally
if (typeof location !== 'undefined' && location.hostname === 'localhost') {
const url = new URL(item.url);
url.protocol = location.protocol;
url.host = location.host;
return { ...item, url: url.href };
}
return item;
});
},
resultsFooterComponent() {
return createElement(
'div',
{ className: 'api-search-notice' },
createElement('p', { className: 'api-search-notice-text' },
'API references are intentionally omitted from this search. To find API references, please search these dedicated API pages instead:',
),
createElement(
'div',
{ className: 'api-search-notice-buttons' },
createElement('a', { href: `${import.meta.env.BASE_URL}reference/api/csharp/`, className: 'api-search-btn' }, 'C# API Reference'),
createElement('a', { href: `${import.meta.env.BASE_URL}reference/api/typescript/`, className: 'api-search-btn' }, 'TypeScript API Reference'),
),
);
},
} satisfies DocSearchClientOptions;
2 changes: 2 additions & 0 deletions src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@astro-community/astro-embed-youtube": "^0.5.9",
"@astrojs/rss": "^4.0.15",
"@astrojs/starlight": "^0.37.6",
"@astrojs/starlight-docsearch": "^0.7.0",
"@catppuccin/starlight": "^1.1.1",
"@expressive-code/plugin-collapsible-sections": "^0.41.3",
"@expressive-code/plugin-line-numbers": "^0.41.3",
Expand All @@ -54,6 +55,7 @@
"astro-tooltips": "^0.6.2",
"marked": "^17.0.3",
"mermaid": "^11.12.2",
"preact": "^10.29.0",
"remark-directive": "^4.0.0",
"sharp": "^0.34.5",
"starlight-contributor-list": "^0.3.2",
Expand Down
Loading